What are all the steps needed to migrate from Video Embed WYSIWYG to Core Media (images/video fields too)?

1 week 2 days ago

As the title suggests, I'm in the process of upgrading from Drupal 9 to 10 and would like to finally migrate over to Core Media, as opposed to just using inline video/images/files as we have for the last many years.

I have followed the following blog post https://blog.horizontaldigital.com/how-migrate-video-embed-wysiwyg-drupal-core-media but feel like I am missing something as it didn't seem to do anything for me.

I copy and pasted the supplied Update Hook code into a custom module and ran a database update, which told me the hook was applied, however, I don't seem to notice anything changing to my site.

Am I missing something? Is there another step after this in order for me to uninstall video_embed_wysiwyg and use core media for all active content?

Any help/suggestions would be greatly appreciated (explain in simple terms, preferably with depth). I'm not one who has lots of knowledge with hooks/php in general but can use it when needed.

Many thanks in advance.

ACanadianCoder

BrowserTest on a multisite gives an error

1 week 2 days ago

My sites directory looks like this:

default, site1, site2, site3.

The default directory is empty. I want to run tests against my site1 database. So I have put its details in phpunit.xml

Here is my phpunit.xml set up.

<php> <!-- Set error reporting to E_ALL. --> <ini name="error_reporting" value="32767"/> <!-- Do not limit the amount of memory tests take to run. --> <ini name="memory_limit" value="-1"/> <!-- Example SIMPLETEST_BASE_URL value: http://localhost --> <env name="SIMPLETEST_BASE_URL" value="http://d8.site1.dev"/> <!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/databasename#table_prefix --> <env name="SIMPLETEST_DB" value="mysql://site1:site1@localhost/site1"/> <!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output --> <env name="BROWSERTEST_OUTPUT_DIRECTORY" value=""/> </php>

And then my actual test:

<?php namespace Drupal\Tests\my_module\Functional; use Drupal\Core\Url; use Drupal\Tests\BrowserTestBase; /** * Simple test to ensure that main page loads with module enabled. * * @group my_module_tests */ class LoadTest extends BrowserTestBase { /** * Modules to enable. * * @var array */ public static $modules = ['my_module']; /** * A user with permission to administer site configuration. * * @var \Drupal\user\UserInterface */ protected $user; /** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->user = $this->drupalCreateUser(['administer site configuration']); $this->drupalLogin($this->user); } /** * Tests that the home page loads with a 200 response. */ public function testLoad() { $this->drupalGet('node/add/product_list_page'); $this->assertResponse(200); } }

Then from the core directory of Drupal I run:

../../vendor/bin/phpunit --group my_module_group

Then I get this error:

1) Drupal\Tests\my_module\Functional\LoadTest::testLoad copy(/var/www/site/docroot/sites/default/default.settings.php): failed to open stream: No such file or directory

Why is it looking in my empty default directory and not site1 for this file?

chap

How to reference external JS callback in custom module

1 week 2 days ago

So I apologize if I mess the terms here up, I'm relatively new to using jQuery in Drupal. I'm trying to implement a custom Google Map application with the V3 API. When I started mocking the module up I had no problem invoking the google maps function callback without my JS being wrapped in a closure. However, needing to use jQuery functions pointed me to wrapping my JS in a closure and referencing jquery, as well as attaching my js to the Drupal.behaviors object. The problem that I have is that now it seems that the callback on my Google Maps script tag is out of scope. I'm not sure if this is due to the closure, due to how I'm loading the script, or something else that I haven't come across yet. The specific JS error I get is

Uncaught (in promise) message: "initMap is not a function"

My module JS is

(function ($) { Drupal.behaviors.gmap_json = { attach : function (context, settings){ var map, alumLayer, chapterLayer, assocLayer, userLayer; function initMap() { map = new google.maps.Map(document.getElementById('json-map'), { zoom: 4, center: {lat: 38.43, lng: -90} }); alumLayer.setStyle({ icon: 'purple.png', }); } } }; alert('it works'); }(jQuery));

And my module php is

function gmap_json_block_info() { $blocks = array(); $blocks['gmap_json'] = array( 'info' => t('Google Maps with GeoJSON'), ); return $blocks; } function gmap_json_block_view($delta = '') { $block = array(); if ($delta == 'gmap_json') { $block['subject'] = ''; $block['content'] = '<div id="json-map" style="width:1100px; height:500px; margin:auto;"></div>'; } $path = drupal_get_path('module', 'gmap_json'); drupal_add_js('https://maps.googleapis.com/maps/api/js?key=mykey&callback=initMap', 'external'); drupal_add_js($path. '/gmap_json.js', 'file'); return $block; }

So, what am I doing wrong and how can I either bring my callback into scope? Or what's the right way to set this up.

EDIT: I have attempted to implement both the answer as well as one of the comments.

drupal_add_js('https://maps.googleapis.com/maps/api/js?key=mykey&callback=initMap', array('type' => 'external', 'defer' => 'defer'));

Adding a "defer" via array doesn't produce any changes, and changing the order of my calls to the js only changes where the error gets called.

nizz0k

Full phrase search

1 week 2 days ago

Now I'm using "Search_api" module and when I input, for example, "test case" - it's output all articles which consists both of this words separately. But I want to make search with exact phrase "test case". How can I do it? Maybe there is another module, or I can rework this one?

Nikita Yunoshev

How to set a validation error via ajax?

1 week 2 days ago

I am using the formapi to create a form. On one of my fields I have an #ajax call. When the field is changed I call the function. I recreate the form and then replace the whole form on the page. This works fine.

When creating the form I have some logic that sets the form state to see if a field has a value. If it has a value then I show some more fields. If the value is not set then I don't show the fields. I am showing the fields by setting the #access on the field.

I need to add some validation on the form when the ajax call is triggered. I have tried adding the validation using form_set_error() in the function that creates the form and in the ajax callback but the error is not displayed on the screen.

Am I going about this the wrong way completely? How can I get the form error to display?

user13134

Migration Plus entity_lookup fails

1 week 2 days ago

Drupal version: 8.7.1. Used modules:

  • Migrate
  • Migrate Plus
  • Migrate Tools
  • Migrate Spreadsheet

I'm trying to generate a taxonomy term if this does not already exist. the migration file:

... source: plugin: spreadsheet columns: ... - 'Functie' ... process: ... field_function: plugin: entity_generate source: 'Functie' value_key: name ignore_case: true bundle: function entity_type: taxonomy_term ...

The taxonomy bundle name is function and the column in the spreadsheet containing the values is 'Functie'. However, I'm getting the following error:

[error] Error: Call to a member function getConfig() on null in Drupal\migrate_plus\Plugin\migrate\process\EntityLookup->determineLookupProperties() (line 217 of /var/www/html/web/modules/contrib/migrate_plus/src/Plugin/migrate/process/EntityLookup.php)

/var/www/html/web/modules/contrib/migrate_plus/src/Plugin/migrate/process/EntityLookup.php(182): Drupal\migrate_plus\Plugin\migrate\process\EntityLookup->determineLookupProperties('field_function')

/var/www/html/web/modules/contrib/migrate_plus/src/Plugin/migrate/process/EntityGenerate.php(116): Drupal\migrate_plus\Plugin\migrate\process\EntityLookup->transform('Medewerker', Object(Drupal\migrate_tools\MigrateExecutable), Object(Drupal\migrate\Row), 'field_function')

/var/www/html/web/core/modules/migrate/src/MigrateExecutable.php(394): Drupal\migrate_plus\Plugin\migrate\process\EntityGenerate->transform('Medewerker', Object(Drupal\migrate_tools\MigrateExecutable), Object(Drupal\migrate\Row), 'field_function')

/var/www/html/web/core/modules/migrate/src/MigrateExecutable.php(203): Drupal\migrate\MigrateExecutable->processRow(Object(Drupal\migrate\Row))

/var/www/html/vendor/drush/drush/includes/drush.inc(223): Drupal\migrate\MigrateExecutable->import()

/var/www/html/vendor/drush/drush/includes/drush.inc(214): drush_call_user_func_array(Array, Array)

/var/www/html/web/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php(766): drush_op(Array)

[internal function]: Drupal\migrate_tools\Commands\MigrateToolsCommands->executeMigration(Object(Drupal\migrate\Plugin\Migration), 'profiles', Array)

/var/www/html/web/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php(321): array_walk(Array, Array, Array)

[internal function]: Drupal\migrate_tools\Commands\MigrateToolsCommands->import('profiles', Array)

/var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)

/var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))

/var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(178): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))

/var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(302): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))

/var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

/var/www/html/vendor/symfony/console/Application.php(978): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

/var/www/html/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

/var/www/html/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

/var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

/var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(49): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))

/var/www/html/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)

/var/www/html/vendor/drush/drush/includes/preflight.inc(18): require('/var/www/html/v...')

phar:///usr/local/bin/drush/bin/drush.php(141): drush_main() /usr/local/bin/drush(10): require('phar:///usr/loc...')

If anyone could point out what's going wrong, by all means, enlighten me because I have no clue what's going on, the configuration seems right to me.

Geordi Feijens

Erroneous .tar.gz created by drush archive:dump. The archive cannot be restored with drush archive:restore

1 week 2 days ago

I use Debian 11, PHP 8.1.28, drupal/core-recommended:10.2.6 and drush/drush:12.5.2.

When I run drush archive:dump no error is reported. But when I want to restore the archive with drush archive:restore I receive the following error that seems to be related to the contents of the .tar.gz file:

[warning] PharData::extractTo(/home/drupal/drush-backups/drushTpUnvd/drupal_site/code/web/.gitignore): Failed to open stream: No such file or directory ArchiveRestoreCommands.php:258 In ArchiveRestoreCommands.php line 258: Extraction from phar "/home/drupal/drush-backups/drupal_site.tar.gz" failed: Cannot extract "code/web/.gitignore", could not open for writing "/home/drupal/drush-backups/drushTpUnvd/drupal_site/code/web/.gitignore"

The command "tar -xvzf drupal_site.tar.gz" reports errors similar with the following at the standard error:

tar: code/web/.gitignore: Cannot open: Not a directory tar: code/web/modules/README.txt: Cannot open: Not a directory tar: code/web/robots.txt: Cannot open: Not a directory tar: code/web/.eslintrc.json: Cannot open: Not a directory tar: code/web/.csslintrc: Cannot open: Not a directory tar: code/web/profiles/README.txt: Cannot open: Not a directory tar: code/web/.ht.router.php: Cannot open: Not a directory tar: code/web/INSTALL.txt: Cannot open: Not a directory tar: code/web/autoload.php: Cannot open: Not a directory tar: code/web/README.md: Cannot open: Not a directory ... tar: code/web/sites/default/settings.php: Cannot open: Not a directory tar: code/web/sites/default/services.yml: Cannot open: Not a directory tar: code/web/sites/default/default.services.yml: Cannot open: Not a directory ... tar: Exiting with failure status due to previous errors

Is this a known issue? Is there any workaround?

Thank you.

quilx

Conditional subelement within custom composite webform element

1 week 2 days ago

I have a webform that has a custom composite element; let's name it composite_name.

Within that custom composite, I have element_a, element_b, and element_c.

Is it possible to make element_c visible only when a value is entered in either element_a or element_b, by editing the composite element in the Webform UI?

I tried putting this in the custom properties for element_c, but it does not work:

states: visible: - ':input[name=["composite_name"]["element_a"]]': filled: true - or - ':input[name=["composite_name"]["element_b"]]': filled: true

I also tried a few variations on that, with no success. I don't know whether I just have some punctuation out of place or something.

It looks like I could make the condition happen using a custom module (following the webform_example_composite module's code), but I'm hoping to configure it in the UI.

Brian Smith

Can't seem to find a way to have & in a term description show up as &

1 week 2 days ago

In a site on D9. I have a vocabulary that has titles as the term descriptions.

One of the term descriptions is This & That No matter what I try, the & is converted to & in CKeditor4.

This happens as soon as it's typed. I.e., clicking Source shows the text as

<p>This &amp; That</p>

and the eventual rendering is the same. I've tried all text formats for the CKEditor text, and have, in the Basic filter, turned off any plugins for fixing HTML, etc., No effect.

As to the suggestion of using the raw value. The field in the view is set to rewrite results as such:

{{ description__value__value }}

with description__value__value being defined in the list as the raw value.

The preview (and actual page using the block) show the result as:

  • This &amp; That
JAyenGreen

how to rename file before/after upload

1 week 2 days ago

I want to rename an up-loaded file. I have the following code. I have defined a submit handler to do so.

function example_form_submit(&$form, FormStateInterface $form_state) { if ($form_state->hasFileElement()) { $video_file_file_array = $form_state->getValue('field_video_file'); if (is_array($video_file_file_array)) { if (isset($video_file_file_array[0])) { $video_file_file_id = $video_file_file_array[0]['fids'][0]; if($video_file_file_id){ $file = \Drupal\file\Entity\File::load($video_file_file_id); $file->set('filename', 'something'); $file->save(); } } } } }

This is not working. Is there any other way.

Dushyant Joshi

Mismatched entity and/or field definitions

1 week 2 days ago

I have no idea how to fix this, I don't even understand what the problem is.

Mismatched entity and/or field definitions The following changes were detected in the entity type and field definitions. Taxonomy term The Term ID field needs to be installed. The UUID field needs to be installed. The Language field needs to be installed. The Vocabulary field needs to be installed. The Name field needs to be installed. The Description field needs to be installed. The Weight field needs to be installed. The Term Parents field needs to be installed. The Changed field needs to be installed. The Default translation field needs to be installed. The taxonomy_term.field_icon field needs to be installed. The taxonomy_term.field_link field needs to be installed. The taxonomy_term.field_meta_tags field needs to be installed.

I tried drush entity-updates but it finishes on error:

Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/vhosts/mysite/httpdocs/core/lib/Drupal/Component/Serialization/Yaml.php on line 54 Drush command terminated abnormally due to an unrecoverable error. [error] Error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/vhosts/mysite/httpdocs/core/lib/Drupal/Component/Serialization/Yaml.php, line 54

EDITED (after fixing drush install) I get the following for drush entity-updates

-sh-4.1$ drush entity-updates The following updates are pending: taxonomy_term entity type : The UUID field needs to be installed. The Language field needs to be installed. The Vocabulary field needs to be installed. The Name field needs to be installed. The Description field needs to be installed. The Weight field needs to be installed. The Term Parents field needs to be installed. The Changed field needs to be installed. The Default translation field needs to be installed. The taxonomy_term.field_icon field needs to be installed. The taxonomy_term.field_link field needs to be installed. The taxonomy_term.field_meta_tags field needs to be installed. Do you wish to run all pending updates? (y/n): y Drupal\Core\Entity\EntityStorageException: Exception thrown while performing a schema update. Cannot add unique key [error] taxonomy_term_field__uuid__value to table taxonomy_term_data: unique key already exists. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (line 1470 of /var/www/vhosts/mysite/httpdocs/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php). Failed: Drupal\Core\Entity\EntityStorageException: !message in Drupal\Core\Entity\Sql\SqlContentEntityStorage-&gt;wrapSchemaException() (line [error] 1470 of /var/www/vhosts/mysite/httpdocs/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php). Cache rebuild complete. [ok] Finished performing updates.

The bizarre thing is that all these things (field_icon, link, meta_tags..) are installed.

The site has many modules (both custom and from the drupal community) and it works alright. Should I export it all and do a clean install and then import it?

UPDATE

I did not manage to fix this and it was giving very weird problems out of the blue, although the already created content types and nodes worked fine. After 24h+ of non stop working I reset the stype up from a clean install and copied content manually (tried doing the Configuration > Configuration synchronization with single items, but it didn't work very well).

I can report now that the problem is gone. I have no idea what could have caused it or even when.

Chayemor

How to get S3 file path from URI?

1 week 2 days ago

So inside my hook function I have URI of some file and I need to find it's S3 path (using s3fs module). How can I do that, to avoid manual string manipulation? Is there some helper function?

I found convertUriToKeyedPath() of S3fsStream class but it's protected and also it says "Converts a Drupal URI path into what is expected to be stored in S3" and that "expect is potentially dangerous.

MilanG

Loading mixed content

1 week 3 days ago

I have a site loading over https. However, two items are being picked up in Chrome as targeting http, and I can't figure out where to look to change them. They are:

  1. GSS search form: we are using Google Site Search module, and it's posting to http.

  2. Drupal Views are posting to http, rather than https. Not sure how to override this.

Any help would be greatly appreciated. Thanks!

cbcorbett

Can you set default configuration settings for a contrib on install?

1 week 3 days ago

I am looking to set default configuration settings for a contributed module, Nodeaccess, on install. I know that you can do that on site spin-up but this module will not be enabled by default. I tried creating a nodeaccess.settings.yml and placing it in the config/install folder but when I go to enabled the Nodeaccess module, an error notification appears: Unable to install Nodeaccess, nodeaccess.settings already exists in active configuration.

Is there a way to set default configuration settings for Nodeaccess on install? Thanks for your time.

-Chad

Chad

"The file phpC128.tmp could not be saved. An unknown error has occurred. File upload error. Could not move uploaded file."

1 week 3 days ago

I have Drupal 8.4 running on Windows Server 2016, and when trying to use an upload field on a content type I get this error

The file phpC128.tmp could not be saved. An unknown error has occurred.
File upload error. Could not move uploaded file.

I deleted the files folder and the account PHP is running under, recreated it for this month as expected, but this still errors out. I see the file in c:\windows\temp, but it doesn't make it to my site folder. The account has full control to the files and 2018-06 folders.

In IIS, the AppPool is running under ApplicationPoolIdentity as well.

David Lozzi

Get node view count for each day

1 week 3 days ago

I have site with thousands of user and logins each day. I need to track each page views of each user to generate a report.

If a user 'A' visits a page 'P' today, a new entry daycount is added to the DB. If the same user 'A' visits the same page 'P' on same day, the daycount will increment by one. If a user 'A' visits page 'P' tomorrow, a new entry daycount is added to the DB.

I am using drupal 7. The insert and update works properly if there is no date comparison. Once i added if($TimeNow > $UpdateTime), the page load never ends. Can anyone help me to fix this.

if(db_query('SELECT daycount FROM {report_page_view} WHERE id = 9999999990 AND uid = :uid )', array(':uid' => $GLOBALS['user']->uid))->rowCount() == 0) { $ChQry = "(SELECT timestamp FROM {report_page_view} WHERE id = 9999999990 AND uid = :uid )', array(':uid' => $GLOBALS['user']->uid)"; // Get the previous timestamp $ChResult = db_query($ChQry); while ( $ChGetResult = $ChResult->fetchAssoc() ) { $TimeStm = $ChGetResult['timestamp']; } $UpdateTime = $TimeStm + 86400; //Get the next day $TimeNow = time(); if($TimeNow > $UpdateTime) { // Compare current time and tomorrows date // insert if condition works $insert_page = db_insert('report_page_view')->fields(array('title', 'memberorg', 'id', 'type', 'timestamp', 'daycount', 'uid', 'fname', 'lname')); $insert_page->values(array( 'title' => $Title, 'memberorg' => $MemberOrg, 'id' => 9999999990, 'type' => 'views', 'timestamp' => REQUEST_TIME, 'daycount' => 1, 'uid' => $UserId, 'fname' => $FName, 'lname' => $LName, )); $insert_page->execute(); } } // else update db_update('report_page_view') ->fields(array( 'title' => $Title, 'memberorg' => $MemberOrg, 'id' => 9999999990, 'type' => 'views', 'timestamp' => REQUEST_TIME, 'daycount' => 1, 'uid' => $UserId, 'fname' => $FName, 'lname' => $LName, )) ->expression('daycount', 'daycount + 1')`
drup

How do I enable a PHP extension on GitLab CI?

1 week 3 days ago

I'm trying to use Drupal.org's GitLab CI to test a module that has a dependency on a package that requires PHP's ext-sodium to be installed:

No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information. Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires PHP extension ext-sodium * but it is missing from your system. Install or enable PHP's sodium extension. Problem 2 - kreait/firebase-php[7.0.0, ..., 7.0.3] require lcobucci/jwt ^4.2.1 -> satisfiable by lcobucci/jwt[4.2.1, ..., 4.4.x-dev]. - kreait/firebase-php[7.1.0, ..., 7.x-dev] require lcobucci/jwt ^4.3.0|^5.0 -> satisfiable by lcobucci/jwt[4.3.0, 4.3.x-dev, 4.4.x-dev, 5.0.0, ..., 5.4.x-dev]. - lcobucci/jwt[4.2.1, ..., 4.4.x-dev, 5.0.0, ..., 5.4.x-dev] require ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension. - Root composer.json requires kreait/firebase-php ^7 -> satisfiable by kreait/firebase-php[7.0.0, ..., 7.x-dev]. To enable extensions, verify that they are enabled in your .ini files: - /usr/local/etc/php/php-cli.ini You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode. Alternatively, you can run Composer with `--ignore-platform-req=ext-sodium` to temporarily ignore these required extensions.

source pipeline

I tried adding ext-sodium to the module's composer.json:

"require": { "php": ">=8.1", "ext-sodium": "*", "kreait/firebase-php": "^7" },

But that doesn't help; I'm still getting the same error.

What's the proper approach to ensure that a PHP extension is enabled on Drupal.org's GitLab CI?

Update: It seems libsodium is uniquely a pain because it is now incorporated into PHP8.1. Issue here.

Patrick Kenny

Scheduler Module crontab job does not publish content

1 week 3 days ago

When running the Scheduler lightweight cron through crontab, I am getting a message that the lightweight cron has activated and completed in my D8 log, but content is not publishing. When running the lightweight cron through backoffice, items publish correctly. I've checked the cron log to see if the cron is encountering errors, and am seeing no issues. Is there something I am missing in my crontab command that is causing the cron to run but not update publish status on any of the scheduled nodes?

DavidAlan31

Profile field create and set default value programmatically

1 week 3 days ago

I need the checkbox to be checked by default. Below is my code, notice the 'default_value' under the settings array.

$field_instance = array( 'field_name' => $fielddef['field_name'], 'type' => 'list_boolean', 'entity_type' => 'user', 'bundle' => 'user', 'label' => t($opts['label']), 'description' => t($opts['description']), 'required' => FALSE, 'widget' => array( 'type' => 'options_onoff', 'weight' => 10, ), 'settings' => array( 'allowed_values' => drupal_map_assoc(range(0,1)), 'default_value' => array(array('value' => 1)) ) ); field_create_instance($field_instance);

I have tried using 'default_value' in the $field_instance array, I've also tried 'default_value_function' without success. I feel like I'm close on this, what am I missing? Thanks!

Also, I am running Drupal 7.23 as shown on my Status Report. I asked this question earlier on SO, but no reply so I moved it here: https://stackoverflow.com/q/19772646/988355

Patrick Jones

How to add multiple products to cart at the same time with attributes

1 week 3 days ago

I have different view blocks that display multiple products on the same page, each product has their own attributes such as product bundle and custom line item, these serves as an option set / criteria of the main product. The results of the options slider will be the value of the customs line item that is hidden.

What I plan to accomplish is to add all these selected products with the selected attributes on the cart at the same time with just one button.

Example:

Product 1:

Product 2:

These are the methods/modules I have tried:

The first two methods work for the main product only, no attributes of the customs line item and bundle products. I tried including the add to cart form in the view with the VBO or commerce product: quantity field of commerce add to cart extras but it doesn't work maybe because it's a form within a form.

Does anyone have any suggestion on how to make this work?

Thank you in advance!

Danz
Checked
11 hours 1 minute ago
most recent 30 from drupal.stackexchange.com
Subscribe to Drupal StackExchange feed