To detect a URL change in a single page React application you can use the following code snippet:
import { withRouter } from 'react-router-dom'; history.listen((location, action) => { console.log("on route change"); // Do stuff. })
To detect a URL change in a single page React application you can use the following code snippet:
import { withRouter } from 'react-router-dom'; history.listen((location, action) => { console.log("on route change"); // Do stuff. })
You’ll need to add the following to your info.yml, yes, not to libraries.
stylesheets-remove:
– ‘@module_name/path/to/your/file.css’
You sometimes find that update hooks run in an unwanted order that affects their behaviour or creates errors and makes your site crash. You can override this and specify the order that you want with the following hook in your .install file.
function new_module_update_dependencies() { // Run new_module update after old_module update. $dependencies['new_module'][7001] = array( 'old_module' => 7000, ); return $dependencies; }
After getting this error:
▶ sudo gem install compass ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/sass
It can be fixed with:
▶ brew install ruby ▶ sudo gem install -n /usr/local/bin compass
drush site-install standard install_configure_form.site_default_country=FR my_profile_form.my_settings.key=value
brew doctor brew update brew install mysql unset TMPDIR mysqld -initialize --verbose --user=whoami --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
(only use this last one for El Capitan)
mysql.server start brew services start mysql
Successfully executed thanks to http://stackoverflow.com/questions/34345726/brew-install-mysql-on-mac-os-el-capitan
To check the path of the current page:
$is_admin = \Drupal::service('router.admin_context')->isAdminRoute();
to check an arbitrary path, you need to create a Request object and obtain its matching Route:
use Symfony\Component\HttpFoundation\Request; use Symfony\Cmf\Component\Routing\RouteObjectInterface; $path = '/node/1'; $request = Request::create($path); $route_match = \Drupal::service('router.no_access_checks')->matchRequest($request); $route = $route_match[RouteObjectInterface::ROUTE_OBJECT]; $is_admin = \Drupal::service('router.admin_context')->isAdminRoute($route);
via: https://api.drupal.org/comment/60024#comment-60024
drush fnh anyHookName
$ apt-get install software-properties-common
$ sudo: add-apt-repository: command not found
$ sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install nodejs
$ sudo npm install -g grunt-cli
/**
* Implements hook_html_head_alter().
* moving og:title up in head element list
*/
function mymodule_html_head_alter(&$head_elements) {
foreach ($head_elements as $key => $element) {
if($key == 'metatag_og:title') {
$head_elements[$key]['#weight'] = -999;
}
}
}