Fix not generating images with image styles
solved with this
chmod -R ugo+rwx files/
chmod -R ugo+rwx private/
chmod -R ugo+rwx tmp/
solved with this
chmod -R ugo+rwx files/
chmod -R ugo+rwx private/
chmod -R ugo+rwx tmp/
Drupal 7:
$conf['file_temporary_path'] = 'files/tmp';
$conf['file_private_path'] = 'files/private';
$conf['file_public_path'] = 'files/public';
Drupal 8+:
$settings['config_sync_directory'] = '../config/sync';
$settings['file_public_path'] = '../files/public';
$settings['file_private_path'] = '../files/private';
$settings['file_temp_path'] = '../files/tmp';
$settings['trusted_host_patterns'] = [
'^example\.com$',
];
Import translations:
drush locale:import --override=all fr modules/custom/base/translations/base.fr.po && drush cr
Execute migrate:
drush migrate-import entity_invoice --update
Execute cron job by name:
drush simple-cron incoming_session_archive --force
How can I change theme? For Drupal8+:
$connection = \Drupal::service('database');
$connection->update('locales_target')
->fields([
'customized' => 0,
])
->execute();
$connection->delete('key_value')
->condition('collection', 'locale.translation_status')
->execute();
$connection->update('locale_file')
->fields([
'timestamp' => 0,
'last_checked' => 0,
])
->execute();
{{ dump() }}
{{ dump(variable_name) }}
List available variables (at top level):
{{ dump(_context|keys) }}
If you have Devel module, you can get an accordion display of the variables available to twig with:
{{ devel_dump() }}
Debugging with console.log
We can add the following to a twig template and view the logs in the browser:
Setup Dev Environment on Mac OS
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
export PATH="/opt/homebrew/bin:$PATH"
brew install wget composer node gnu-tar gpatch git
Install drush on mac:
To delete nodes:
$type = ['invoice'];
$nids = db_select('node', 'n')
->fields('n', array('nid'))
->condition('type', $type, 'IN')
->execute()->fetchCol();
if (!empty($nids)) {
dsm($nids);
node_delete_multiple($nids);
drupal_set_message(t('Deleted %count nodes.', array('%count' => count($nids))));
}
To detele custom entity type:
composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader --sort-packages --no-update
composer update
@variable: When the placeholder replacement value is:
A string, the replaced value in the returned string will be sanitized using \Drupal\Component\Utility\Html::escape().
A MarkupInterface object, the replaced value in the returned string will not be sanitized.
A MarkupInterface object cast to a string, the replaced value in the returned string be forcibly sanitized using \Drupal\Component\Utility\Html::escape().
Here we extend system Drupal.Ajax.prototype.beforeSend() method. We set progress variable according to data attribute.
let ajaxBeforeSendOriginal = Drupal.Ajax.prototype.beforeSend;
// Extend Drupal.Ajax.prototype.beforeSend.
Drupal.Ajax.prototype.beforeSend = function (xmlhttprequest, options) {
// Set progress variable according to data attribute.
this.progress.type = $(this.element).data("ajax-progress") ||
this.progress.type; ajaxBeforeSendOriginal.call(this, xmlhttprequest, options);
};