alter example

$rows['statistics'][] = [
              [
                'data' => [
                  '#type' => 'inline_template',
                  '#template' => "<strong>{% trans 'View render time' %}</strong>",
                ],
              ],
              t('@time ms', ['@time' => intval($this->render_time * 100) / 100]),
            ];
          }
          \Drupal::moduleHandler()->alter('views_preview_info', $rows$executable);
        }
        else {
          // No query was run. Display that information in place of either the           // query or the performance statistics, whichever comes first.           if ($combined || ($show_location === 'above')) {
            $rows['query'][] = [
              [
                'data' => [
                  '#prefix' => '<strong>',
                  '#markup' => t('Query'),
                  '#suffix' => '</strong>',
                ],
/** * {@inheritdoc} */
  public function getDefinedLanguageTypesInfo() {
    if (!isset($this->languageTypesInfo)) {
      $defaults = parent::getDefinedLanguageTypesInfo();

      $info = $this->moduleHandler->invokeAll('language_types_info');
      $language_info = $info + $defaults;

      // Let other modules alter the list of language types.       $this->moduleHandler->alter('language_types_info', $language_info);
      $this->languageTypesInfo = $language_info;
    }
    return $this->languageTypesInfo;
  }

  /** * {@inheritdoc} */
  public function saveLanguageTypesConfiguration(array $values) {
    $config = $this->configFactory->getEditable('language.types');
    if (isset($values['configurable'])) {
      
'#pre_render' => [[$this, 'buildMultiple']],
    ];
    $weight = 0;
    foreach ($entities as $key => $entity) {
      // Ensure that from now on we are dealing with the proper translation       // object.       $entity = $this->entityRepository->getTranslationFromContext($entity$langcode);

      // Set build defaults.       $build_list[$key] = $this->getBuildDefaults($entity$view_mode);
      $entityType = $this->entityTypeId;
      $this->moduleHandler()->alter([$entityType . '_build_defaults', 'entity_build_defaults']$build_list[$key]$entity$view_mode);

      $build_list[$key]['#weight'] = $weight++;
    }

    return $build_list;
  }

  /** * Provides entity-specific defaults to the build process. * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity for which the defaults should be provided. * @param string $view_mode * The view mode that should be used. * * @return array */

  public function getAccountName() {
    return $this->get('name')->value ?: '';
  }

  /** * {@inheritdoc} */
  public function getDisplayName() {
    $name = $this->getAccountName() ?: \Drupal::config('user.settings')->get('anonymous');
    \Drupal::moduleHandler()->alter('user_format_name', $name$this);
    return $name;
  }

  /** * {@inheritdoc} */
  public function setUsername($username) {
    $this->set('name', $username);
    return $this;
  }

  
// Still empty, so we have to rebuild.         $module_data = $this->moduleExtensionList->reset()->getList();
        $theme_data = $this->themeHandler->rebuildThemeData();
        $project_info = new ProjectInfo();
        $project_info->processInfoList($this->projects, $module_data, 'module', TRUE);
        $project_info->processInfoList($this->projects, $theme_data, 'theme', TRUE);
        if ($this->updateSettings->get('check.disabled_extensions')) {
          $project_info->processInfoList($this->projects, $module_data, 'module', FALSE);
          $project_info->processInfoList($this->projects, $theme_data, 'theme', FALSE);
        }
        // Allow other modules to alter projects before fetching and comparing.         $this->moduleHandler->alter('update_projects', $this->projects);
        // Store the site's project data for at most 1 hour.         $this->keyValueStore->setWithExpire('update_project_projects', $this->projects, 3600);
      }
    }
    return $this->projects;
  }

  /** * {@inheritdoc} */
  public function projectStorage($key) {
    
// Format-specific JavaScript settings.       $settings['editor']['formats'][$format_id] = [
        'format' => $format_id,
        'editor' => $editor->getEditor(),
        'editorSettings' => $plugin->getJSSettings($editor),
        'editorSupportsContentFiltering' => $plugin_definition['supports_content_filtering'],
        'isXssSafe' => $plugin_definition['is_xss_safe'],
      ];
    }

    // Allow other modules to alter all JavaScript settings.     $this->moduleHandler->alter('editor_js_settings', $settings);

    if (empty($attachments['library']) && empty($settings)) {
      return [];
    }

    $attachments['drupalSettings'] = $settings;

    return $attachments;
  }

}

    // Our default access flag is masked under the ':default' key.     $grants = array_merge([':default' => $default], ...$grants);

    // Also allow modules to alter the returned grants/denies.     $context = [
      'operation' => $operation,
      'field_definition' => $field_definition,
      'items' => $items,
      'account' => $account,
    ];
    $this->moduleHandler()->alter('entity_field_access', $grants$context);

    $result = $this->processAccessHookResults($grants);
    return $return_as_object ? $result : $result->isAllowed();
  }

  /** * Default field access as determined by this access control handler. * * @param string $operation * The operation access should be checked for. * Usually one of "view" or "edit". * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition * The field definition. * @param \Drupal\Core\Session\AccountInterface $account * The user session for which to check access. * @param \Drupal\Core\Field\FieldItemListInterface $items * (optional) The field values for which to check access, or NULL if access * is checked for the field definition, without any specific value * available. Defaults to NULL. * * @return \Drupal\Core\Access\AccessResultInterface * The access result. */

  public static function collectRenderDisplay(FieldableEntityInterface $entity$form_mode$default_fallback = TRUE) {
    $entity_type = $entity->getEntityTypeId();
    $bundle = $entity->bundle();

    // Allow modules to change the form mode.     \Drupal::moduleHandler()->alter('entity_form_mode', $form_mode$entity);

    // Check the existence and status of:     // - the display for the form mode,     // - the 'default' display.     if ($form_mode != 'default') {
      $candidate_ids[] = $entity_type . '.' . $bundle . '.' . $form_mode;
    }
    if ($default_fallback) {
      $candidate_ids[] = $entity_type . '.' . $bundle . '.default';
    }
    $results = \Drupal::entityQuery('entity_form_display')
      
      // issue.       // - Emit E_USER_DEPRECATED if term_access is used.       // https://www.drupal.org/node/2575081       $term_access_tags = ['term_access' => 1, 'taxonomy_term_access' => 1];
      if (array_intersect_key($this->alterTags, $term_access_tags)) {
        $this->alterTags += $term_access_tags;
      }
      $hooks = ['query'];
      foreach ($this->alterTags as $tag => $value) {
        $hooks[] = 'query_' . $tag;
      }
      \Drupal::moduleHandler()->alter($hooks$query);
    }

    $this->prepared = TRUE;

    // Now also prepare any sub-queries.     foreach ($this->tables as $table) {
      if ($table['table'] instanceof SelectInterface) {
        $table['table']->preExecute();
      }
    }

    
$entity = $this->entityTypeManager->getStorage('comment')->load($comment_entity_id);
      if ($commented_entity = $entity->getCommentedEntity()) {
        $links['comment'] = $this->buildLinks($entity$commented_entity);
      }

      // Allow other modules to alter the comment links.       $hook_context = [
        'view_mode' => $view_mode,
        'langcode' => $langcode,
        'commented_entity' => $commented_entity,
      ];
      $this->moduleHandler->alter('comment_links', $links$entity$hook_context);
    }
    return $links;
  }

  /** * Build the default links (reply, edit, delete …) for a comment. * * @param \Drupal\comment\CommentInterface $entity * The comment object. * @param \Drupal\Core\Entity\EntityInterface $commented_entity * The entity to which the comment is attached. * * @return array * An array that can be processed by drupal_pre_render_links(). */
$element_info['#input'] = TRUE;
        $element_info['#value_callback'] = [$definition['class'], 'valueCallback'];
      }
      $info[$element_type] = $element_info;
    }
    restore_error_handler();

    foreach ($info as $element_type => $element) {
      $info[$element_type]['#type'] = $element_type;
    }
    // Allow modules to alter the element type defaults.     $this->moduleHandler->alter('element_info', $info);
    $this->themeManager->alter('element_info', $info);

    $this->cacheBackend->set($cid$info, Cache::PERMANENT, ['element_info_build']);

    return $info;
  }

  /** * {@inheritdoc} * * @return \Drupal\Core\Render\Element\ElementInterface */
foreach ($breakpoints as $id => $breakpoint) {
        $media_queries[$id] = $breakpoint->getMediaQuery();
      }

      $element['#attached']['drupalSettings']['toolbar']['breakpoints'] = $media_queries;
    }

    $module_handler = static::moduleHandler();
    // Get toolbar items from all modules that implement hook_toolbar().     $items = $module_handler->invokeAll('toolbar');
    // Allow for altering of hook_toolbar().     $module_handler->alter('toolbar', $items);
    // Sort the children.     uasort($items['\Drupal\Component\Utility\SortArray', 'sortByWeightProperty']);

    // Merge in the original toolbar values.     $element = array_merge($element$items);

    // Assign each item a unique ID, based on its key.     foreach (Element::children($element) as $key) {
      $element[$key]['#id'] = Html::getId('toolbar-item-' . $key);
    }

    


      if (!$this->requestStack->getCurrentRequest()->attributes->has('exception')) {
        // Safe to build tasks only when no exceptions raised.         $data = [];
        $local_tasks = $this->getTasksBuild($route_name$cacheability);
        foreach ($local_tasks as $tab_level => $items) {
          $data[$tab_level] = empty($data[$tab_level]) ? $items : array_merge($data[$tab_level]$items);
        }
        $this->taskData[$route_name]['tabs'] = $data;
        // Allow modules to alter local tasks.         $this->moduleHandler->alter('menu_local_tasks', $this->taskData[$route_name]$route_name$cacheability);
        $this->taskData[$route_name]['cacheability'] = $cacheability;
      }
    }

    if (isset($this->taskData[$route_name]['tabs'][$level])) {
      return [
        'tabs' => $this->taskData[$route_name]['tabs'][$level],
        'route_name' => $route_name,
        'cacheability' => $this->taskData[$route_name]['cacheability'],
      ];
    }

    
        throw new InvalidLibraryFileException(sprintf('Invalid library definition in %s: %s', $library_file$e->getMessage()), 0, $e);
      }
    }

    // Allow modules to add dynamic library definitions.     $hook = 'library_info_build';
    if ($this->moduleHandler->hasImplementations($hook$extension)) {
      $libraries = NestedArray::mergeDeep($libraries$this->moduleHandler->invoke($extension$hook));
    }

    // Allow modules to alter the module's registered libraries.     $this->moduleHandler->alter('library_info', $libraries$extension);
    $this->themeManager->alter('library_info', $libraries$extension);

    return $libraries;
  }

  /** * Apply libraries overrides specified for the current active theme. * * @param array $libraries * The libraries definitions. * @param string $extension * The extension in which these libraries are defined. * * @return array * The modified libraries definitions. */


    $replacements = $this->moduleHandler->invokeAll('tokens', [$type$tokens$data$options$bubbleable_metadata]);

    // Allow other modules to alter the replacements.     $context = [
      'type' => $type,
      'tokens' => $tokens,
      'data' => $data,
      'options' => $options,
    ];
    $this->moduleHandler->alter('tokens', $replacements$context$bubbleable_metadata);

    return $replacements;
  }

  /** * Returns a list of tokens that begin with a specific prefix. * * Used to extract a group of 'chained' tokens (such as [node:author:name]) * from the full list of tokens found in text. For example: * @code * $data = array( * 'author:name' => '[node:author:name]', * 'title' => '[node:title]', * 'created' => '[node:created]', * ); * $results = Token::findWithPrefix($data, 'author'); * $results == array('name' => '[node:author:name]'); * @endcode * * @param array $tokens * A keyed array of tokens, and their original raw form in the source text. * @param string $prefix * A textual string to be matched at the beginning of the token. * @param string $delimiter * (optional) A string containing the character that separates the prefix from * the rest of the token. Defaults to ':'. * * @return array * An associative array of discovered tokens, with the prefix and delimiter * stripped from the key. */
Home | Imprint | This part of the site doesn't use cookies.