Drupal 8 countQuery()
$result = \Drupal::database()->select('node')
->condition('type', 'article')
->countQuery()
->execute()->fetchField();
$result = \Drupal::database()->select('node')
->condition('type', 'article')
->countQuery()
->execute()->fetchField();
// Define entity type to lookup.
$entity_type = 'node';
// Execute a query in order to retrieve an array of Article's ids.
$ids = \Drupal::entityQuery($entity_type)
->condition('type', 'article')
->execute();
/** @var \Drupal\node\NodeStorage $controller */
$controller = \Drupal::entityTypeManager()
->getStorage($entity_type);
/** @var \Drupal\node\Entity\Node[] $entities */
$entities = $controller->loadMultiple($ids);
// Deletes permanently saved entities.
$controller->delete($entities);
Something we need to login into our Drupal site without type any credentials, then Drush provides us an easy way to achi
Google Analytics (GA) Allows us to tracking everything into our pages.
Drupal give us an excellent documentation about how to setup our settings file, but what about if we
git remote add [REMOTE_NAME] [REPOSITORY_URL]
git push -u github master
git reset --hard
drush updb --entity-updates
Or
drush entity-updates command
Even
drush entup
drush site-install --db-url=mysql://[db_username]:[db_username_password]@[localhost]:[port]/[database_name]
# Delete from local
git branch –D branch-name
# Delete from remote
git push origin :branch-name
# Another way to delete from remote
git push origin --delete branch-name