breakString example


    }

    return $data;
  }

  /** * Tests the breakString method. */
  public function testBreakString() {
    // Check defaults.     $this->assertEquals((object) ['value' => [], 'operator' => NULL], HandlerBase::breakString(''));

    // Test ors     $handler = HandlerBase::breakString('word1 word2+word');
    $this->assertEquals(['word1', 'word2', 'word']$handler->value);
    $this->assertEquals('or', $handler->operator);
    $handler = HandlerBase::breakString('word1+word2+word');
    $this->assertEquals(['word1', 'word2', 'word']$handler->value);
    $this->assertEquals('or', $handler->operator);
    $handler = HandlerBase::breakString('word1 word2 word');
    $this->assertEquals(['word1', 'word2', 'word']$handler->value);
    $this->assertEquals('or', $handler->operator);
    
unset($actions['summary asc']);
    unset($actions['summary desc']);
    unset($actions['summary asc by count']);
    unset($actions['summary desc by count']);
    return $actions;
  }

  public function query($group_by = FALSE) {
    $this->ensureMyTable();

    if (!empty($this->options['break_phrase'])) {
      $break = static::breakString($this->argument);
      if ($break->value === [-1]) {
        return FALSE;
      }
      $tids = $break->value;
    }
    else {
      $tids = $this->argument;
    }

    $this->addSubQueryJoin($tids);
  }

  
'#default_value' => !empty($this->options['not']),
      '#group' => 'options][more',
    ];
  }

  public function title() {
    if (!$this->argument) {
      return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized');
    }

    if (!empty($this->options['break_phrase'])) {
      $break = static::breakString($this->argument, FALSE);
      $this->value = $break->value;
      $this->operator = $break->operator;
    }
    else {
      $this->value = [$this->argument];
      $this->operator = 'or';
    }

    if (empty($this->value)) {
      return !empty($this->definition['empty field name']) ? $this->definition['empty field name'] : $this->t('Uncategorized');
    }

    
public static function decodeValidatorId($id) {
    return str_replace('---', ':', $id);
  }

  /** * Splits an argument into value and operator properties on this instance. * * @param bool $force_int * Enforce that values should be numeric. */
  protected function unpackArgumentValue($force_int = FALSE) {
    $break = static::breakString($this->argument, $force_int);
    $this->value = $break->value;
    $this->operator = $break->operator;
  }

  /** * {@inheritdoc} */
  public function getCacheMaxAge() {
    $max_age = Cache::PERMANENT;

    // Asks all subplugins (argument defaults, argument validator and styles).
Home | Imprint | This part of the site doesn't use cookies.