本文整理汇总了PHP中Drupal\views\Plugin\views\display\DisplayPluginBase::buildOptionsForm方法的典型用法代码示例。如果您正苦于以下问题:PHP DisplayPluginBase::buildOptionsForm方法的具体用法?PHP DisplayPluginBase::buildOptionsForm怎么用?PHP DisplayPluginBase::buildOptionsForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\views\Plugin\views\display\DisplayPluginBase
的用法示例。
在下文中一共展示了DisplayPluginBase::buildOptionsForm方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildOptionsForm
/**
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state)
{
parent::buildOptionsForm($form, $form_state);
switch ($form_state->get('section')) {
case 'test_option':
$form['#title'] .= $this->t('Test option');
$form['test_option'] = array('#title' => $this->t('Test option'), '#type' => 'textfield', '#description' => $this->t('This is a textfield for test_option.'), '#default_value' => $this->getOption('test_option'));
break;
}
}
示例2: buildOptionsForm
/**
* Provide the default form for setting options.
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state)
{
// It is very important to call the parent function here:
parent::buildOptionsForm($form, $form_state);
switch ($form_state['section']) {
case 'inherit_arguments':
$form['#title'] .= t('Inherit contextual filters');
$form['inherit_arguments'] = array('#type' => 'checkbox', '#title' => t('Inherit'), '#description' => t('Should this display inherit its contextual filter values from the parent display to which it is attached?'), '#default_value' => $this->getOption('inherit_arguments'));
break;
case 'inherit_exposed_filters':
$form['#title'] .= t('Inherit exposed filters');
$form['inherit_exposed_filters'] = array('#type' => 'checkbox', '#title' => t('Inherit'), '#description' => t('Should this display inherit its exposed filter values from the parent display to which it is attached?'), '#default_value' => $this->getOption('inherit_exposed_filters'));
break;
case 'inherit_pager':
$form['#title'] .= t('Inherit pager');
$form['inherit_pager'] = array('#type' => 'checkbox', '#title' => t('Inherit'), '#description' => t('Should this display inherit its paging values from the parent display to which it is attached?'), '#default_value' => $this->getOption('inherit_pager'));
break;
case 'render_pager':
$form['#title'] .= t('Render pager');
$form['render_pager'] = array('#type' => 'checkbox', '#title' => t('Render'), '#description' => t('Should this display render the pager values? This is only meaningful if inheriting a pager.'), '#default_value' => $this->getOption('render_pager'));
break;
case 'attachment_position':
$form['#title'] .= t('Position');
$form['attachment_position'] = array('#title' => t('Position'), '#type' => 'radios', '#description' => t('Attach before or after the parent display?'), '#options' => $this->attachmentPositions(), '#default_value' => $this->getOption('attachment_position'));
break;
case 'displays':
$form['#title'] .= t('Attach to');
$displays = array();
foreach ($this->view->storage->get('display') as $display_id => $display) {
if ($this->view->displayHandlers->has($display_id) && $this->view->displayHandlers->get($display_id)->acceptAttachments()) {
$displays[$display_id] = $display['display_title'];
}
}
$form['displays'] = array('#title' => t('Displays'), '#type' => 'checkboxes', '#description' => t('Select which display or displays this should attach to.'), '#options' => $displays, '#default_value' => $this->getOption('displays'));
break;
}
}
示例3: buildOptionsForm
/**
* Provide the default form for setting options.
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state)
{
parent::buildOptionsForm($form, $form_state);
switch ($form_state->get('section')) {
case 'block_description':
$form['#title'] .= $this->t('Block admin description');
$form['block_description'] = array('#type' => 'textfield', '#description' => $this->t('This will appear as the name of this block in administer >> structure >> blocks.'), '#default_value' => $this->getOption('block_description'));
break;
case 'block_category':
$form['#title'] .= $this->t('Block category');
$form['block_category'] = array('#type' => 'textfield', '#autocomplete_route_name' => 'block.category_autocomplete', '#description' => $this->t('The category this block will appear under on the <a href=":href">blocks placement page</a>.', array(':href' => \Drupal::url('block.admin_display'))), '#default_value' => $this->getOption('block_category'));
break;
case 'block_hide_empty':
$form['#title'] .= $this->t('Block empty settings');
$form['block_hide_empty'] = array('#title' => $this->t('Hide block if no result/empty text'), '#type' => 'checkbox', '#description' => $this->t('Hide the block if there is no result and no empty text and no header/footer which is shown on empty result'), '#default_value' => $this->getOption('block_hide_empty'));
break;
case 'exposed_form_options':
$this->view->initHandlers();
if (!$this->usesExposed() && parent::usesExposed()) {
$form['exposed_form_options']['warning'] = array('#weight' => -10, '#markup' => '<div class="messages messages--warning">' . $this->t('Exposed filters in block displays require "Use AJAX" to be set to work correctly.') . '</div>');
}
break;
case 'allow':
$form['#title'] .= $this->t('Allow settings in the block configuration');
$options = array('items_per_page' => $this->t('Items per page'));
$allow = array_filter($this->getOption('allow'));
$form['allow'] = array('#type' => 'checkboxes', '#default_value' => $allow, '#options' => $options);
break;
}
}
示例4: buildOptionsForm
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::buildOptionsForm().
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state)
{
parent::buildOptionsForm($form, $form_state);
switch ($form_state->get('section')) {
case 'path':
$form['#title'] .= $this->t('The menu path or URL of this view');
$form['path'] = array('#type' => 'textfield', '#title' => $this->t('Path'), '#description' => $this->t('This view will be displayed by visiting this path on your site. You may use "%" in your URL to represent values that will be used for contextual filters: For example, "node/%/feed". If needed you can even specify named route parameters like taxonomy/term/%taxonomy_term'), '#default_value' => $this->getOption('path'), '#field_prefix' => '<span dir="ltr">' . $this->url('<none>', [], ['absolute' => TRUE]), '#field_suffix' => '</span>‎', '#attributes' => array('dir' => LanguageInterface::DIRECTION_LTR), '#maxlength' => 254);
break;
}
}