Search Results
… { $links = []; $links[] = [ 'title' => 'Some title', 'url' => 'internal:/node/666', 'menu_name' => 'main', ] + … use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; … ->loadTree('category', 0, 2, TRUE); foreach ($terms as $term) { // Get URL of object. $term_url = Url::fromRoute('entity.taxonomy_term.canonical', ['taxonomy_term' …
… stores the taxonomy terms for an article. $fieldName = 'field_article_category'; /** @var \Drupal\field\Entity\FieldStorageConfig … method would be called like this, with a field called field_article_category on the article content type. $options = $this->getOptionsFromField('field_article_category', 'node', 'article', $account); The options list we create …
… Set the filter to provide a default value of the content ID from the URL. This will automatically pass the current page to the contextual …
Article: Drupal 8: Automated Spam Protection
… Spam is a constant problem for any site on the internet that has a publicly available form, but automatically preventing … real content being submitted by real users. Manually moderating blog comments is usually a good idea, but many websites contain contact …
… item of content. This system creates powerful search engine friendly URLs that can add keywords to the paths that Drupal uses to find … ->setLabel(t('Slug')) ->setDescription(t('The url slug of the entity.')); return $fields; } } Note the addition of … definitions. This will be used to store the name of this entity as a URL safe string that we can use to convert back into the entity object …
Article: Drupal 7 Audit SQL Queries
When doing site audits on Drupal sites it’s always a good idea to get a feel of what sort of content types, users and taxonomy terms are available. Here are some SQL queries that I tend to use when starting out on a Drupal Audit. User/Roles Breakdown SELECT role.name as Role, COUNT(role.name) as …
… in the ajax callback. The // weight of these elements is set to -50 and +50 so that all other // elements will appear between them. … = [ '#markup' => '<div class="lazy-button-wrapper">', '#weight' => -50, ]; $build['dynamic_lazy_button_suffix'] = [ '#markup' => '</div>', …
… and attempting to guess the next available resource by looking at the URL. Apparently, terabytes of Parler's data was downloaded by simply … post that was loaded using the type and ID of the content in the URL. This means that when a user visits the post they might see a URL with the path /post/1 . If a user wanted to see the next available …