コード例 #1
0
ファイル: Current.php プロジェクト: papillon-cendre/d8
 /**
  * {@inheritdoc}
  */
 public function getCacheContexts()
 {
     $contexts = parent::getCacheContexts();
     // This filter depends on the current user.
     $contexts[] = 'user';
     return $contexts;
 }
コード例 #2
0
  /**
   * {@inheritdoc}
   */
  public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form, $form_state);

    $form['value']['#type'] = 'radios';
    $form['value']['#title'] = t('Status');
    $form['value']['#options'] = [
      1 => t('Flagged'),
      0 => t('Not flagged'),
      // @todo Find out what in the hell filter type ALL is supposed to do.
      // 'All' => t('All'),
    ];
    $form['value']['#default_value'] = empty($this->options['value']) ? FALSE : $this->options['value'];
    $form['value']['#description'] = '<p>' . t('This filter is only needed if the relationship used has the "Include only flagged content" option <strong>unchecked</strong>. Otherwise, this filter is useless, because all records are already limited to flagged content.') . '</p><p>' . t('By choosing <em>Not flagged</em>, it is possible to create a list of content <a href="@unflagged-url">that is specifically not flagged</a>.', array('@unflagged-url' => 'http://drupal.org/node/299335')) . '</p>';

    $form['relationship']['#default_value'] = $this->options['relationship'];
  }
コード例 #3
0
ファイル: EntityQueueInQueue.php プロジェクト: jkyto/agolf
  /**
   * Constructor.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param array $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Session\AccountInterface $current_user
   *   The current user.
   */
  public function __construct(array $configuration, $plugin_id, array $plugin_definition, AccountInterface $current_user) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);

    $this->currentUser = $current_user;
  }
コード例 #4
0
ファイル: Current.php プロジェクト: anatalsceo/en-classe
 /**
  * Overrides Drupal\views\Plugin\views\filter\BooleanOperator::init().
  */
 public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
 {
     parent::init($view, $display, $options);
     $this->value_value = t('Is the logged in user');
 }