You are here

public function ViewsPhp::buildOptionsForm in Views PHP 8

Same name in this branch
  1. 8 src/Plugin/views/area/ViewsPhp.php \Drupal\views_php\Plugin\views\area\ViewsPhp::buildOptionsForm()
  2. 8 src/Plugin/views/filter/ViewsPhp.php \Drupal\views_php\Plugin\views\filter\ViewsPhp::buildOptionsForm()
  3. 8 src/Plugin/views/sort/ViewsPhp.php \Drupal\views_php\Plugin\views\sort\ViewsPhp::buildOptionsForm()
  4. 8 src/Plugin/views/access/ViewsPhp.php \Drupal\views_php\Plugin\views\access\ViewsPhp::buildOptionsForm()
  5. 8 src/Plugin/views/cache/ViewsPhp.php \Drupal\views_php\Plugin\views\cache\ViewsPhp::buildOptionsForm()
  6. 8 src/Plugin/views/field/ViewsPhp.php \Drupal\views_php\Plugin\views\field\ViewsPhp::buildOptionsForm()

Provide a form to edit options for this plugin.

Overrides PluginBase::buildOptionsForm

File

src/Plugin/views/cache/ViewsPhp.php, line 51
Contains \Drupal\views_php\Plugin\views\cache\ViewsPhp.

Class

ViewsPhp
Caching of query results for Views displays based on custom PHP code.

Namespace

Drupal\views_php\Plugin\views\cache

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form += views_php_form_element($this, FALSE, array(
    'php_cache_results',
    t('Result cache code'),
    t('The code must return TRUE if the cache is still fresh, FALSE otherwise.'),
    FALSE,
  ), array(
    '$view',
    '$plugin',
    '$cache',
  ));
  $form += views_php_form_element($this, FALSE, array(
    'php_cache_output',
    t('Output cache code'),
    t('The code must return TRUE if the cache is still fresh, FALSE otherwise.'),
    FALSE,
  ), array(
    '$view',
    '$plugin',
    '$cache',
  ));
  $form['#attached']['library'][] = 'views_php/drupal.views_php';
}