本文整理汇总了PHP中Drupal\views\Plugin\views\HandlerBase::buildOptionsForm方法的典型用法代码示例。如果您正苦于以下问题:PHP HandlerBase::buildOptionsForm方法的具体用法?PHP HandlerBase::buildOptionsForm怎么用?PHP HandlerBase::buildOptionsForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\views\Plugin\views\HandlerBase
的用法示例。
在下文中一共展示了HandlerBase::buildOptionsForm方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildOptionsForm
/**
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state)
{
parent::buildOptionsForm($form, $form_state);
if ($form_state->get('type') != 'empty') {
$form['empty'] = array('#type' => 'checkbox', '#title' => $this->t('Display even if view has no result'), '#default_value' => isset($this->options['empty']) ? $this->options['empty'] : 0);
}
}
示例2: buildOptionsForm
/**
* Basic options for all sort criteria
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state)
{
parent::buildOptionsForm($form, $form_state);
if ($this->canExpose()) {
$this->showExposeButton($form, $form_state);
}
$form['op_val_start'] = array('#value' => '<div class="clearfix">');
$this->showSortForm($form, $form_state);
$form['op_val_end'] = array('#value' => '</div>');
if ($this->canExpose()) {
$this->showExposeForm($form, $form_state);
}
}
示例3: buildOptionsForm
/**
* Provide the basic form which calls through to subforms.
* If overridden, it is best to call through to the parent,
* or to at least make sure all of the functions in this form
* are called.
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state)
{
parent::buildOptionsForm($form, $form_state);
if ($this->canExpose()) {
$this->showExposeButton($form, $form_state);
}
if ($this->canBuildGroup()) {
$this->showBuildGroupButton($form, $form_state);
}
$form['clear_markup_start'] = array('#markup' => '<div class="clearfix">');
if ($this->isAGroup()) {
if ($this->canBuildGroup()) {
$form['clear_markup_start'] = array('#markup' => '<div class="clearfix">');
// Render the build group form.
$this->showBuildGroupForm($form, $form_state);
$form['clear_markup_end'] = array('#markup' => '</div>');
}
} else {
// Add the subform from operatorForm().
$this->showOperatorForm($form, $form_state);
// Add the subform from valueForm().
$this->showValueForm($form, $form_state);
$form['clear_markup_end'] = array('#markup' => '</div>');
if ($this->canExpose()) {
// Add the subform from buildExposeForm().
$this->showExposeForm($form, $form_state);
}
}
}
示例4: buildOptionsForm
public function buildOptionsForm(&$form, &$form_state)
{
parent::buildOptionsForm($form, $form_state);
$argument_text = $this->view->display_handler->getArgumentText();
$form['#pre_render'][] = array(get_class($this), 'preRenderMoveArgumentOptions');
$form['description'] = array('#markup' => $argument_text['description'], '#theme_wrappers' => array('container'), '#attributes' => array('class' => array('description')));
$form['no_argument'] = array('#type' => 'details', '#title' => $argument_text['filter value not present'], '#open' => TRUE);
// Everything in the details is floated, so the last element needs to
// clear those floats.
$form['no_argument']['clearfix'] = array('#weight' => 1000, '#markup' => '<div class="clearfix"></div>');
$form['default_action'] = array('#title' => t('Default actions'), '#title_display' => 'invisible', '#type' => 'radios', '#process' => array(array($this, 'processContainerRadios')), '#default_value' => $this->options['default_action'], '#fieldset' => 'no_argument');
$form['exception'] = array('#type' => 'details', '#title' => t('Exceptions'), '#fieldset' => 'no_argument');
$form['exception']['value'] = array('#type' => 'textfield', '#title' => t('Exception value'), '#size' => 20, '#default_value' => $this->options['exception']['value'], '#description' => t('If this value is received, the filter will be ignored; i.e, "all values"'));
$form['exception']['title_enable'] = array('#type' => 'checkbox', '#title' => t('Override title'), '#default_value' => $this->options['exception']['title_enable']);
$form['exception']['title'] = array('#type' => 'textfield', '#title' => t('Override title'), '#title_display' => 'invisible', '#size' => 20, '#default_value' => $this->options['exception']['title'], '#description' => t('Override the view and other argument titles. Use "%1" for the first argument, "%2" for the second, etc.'), '#states' => array('visible' => array(':input[name="options[exception][title_enable]"]' => array('checked' => TRUE))));
$options = array();
$defaults = $this->defaultActions();
$validate_options = array();
foreach ($defaults as $id => $info) {
$options[$id] = $info['title'];
if (empty($info['default only'])) {
$validate_options[$id] = $info['title'];
}
if (!empty($info['form method'])) {
$this->{$info['form method']}($form, $form_state);
}
}
$form['default_action']['#options'] = $options;
$form['argument_present'] = array('#type' => 'details', '#title' => $argument_text['filter value present'], '#open' => TRUE);
$form['title_enable'] = array('#type' => 'checkbox', '#title' => t('Override title'), '#default_value' => $this->options['title_enable'], '#fieldset' => 'argument_present');
$form['title'] = array('#type' => 'textfield', '#title' => t('Provide title'), '#title_display' => 'invisible', '#default_value' => $this->options['title'], '#description' => t('Override the view and other argument titles. Use "%1" for the first argument, "%2" for the second, etc.'), '#states' => array('visible' => array(':input[name="options[title_enable]"]' => array('checked' => TRUE))), '#fieldset' => 'argument_present');
$form['specify_validation'] = array('#type' => 'checkbox', '#title' => t('Specify validation criteria'), '#default_value' => $this->options['specify_validation'], '#fieldset' => 'argument_present');
$form['validate'] = array('#type' => 'container', '#fieldset' => 'argument_present');
// Validator options include derivatives with :. These are sanitized for js
// and reverted on submission.
$form['validate']['type'] = array('#type' => 'select', '#title' => t('Validator'), '#default_value' => static::encodeValidatorId($this->options['validate']['type']), '#states' => array('visible' => array(':input[name="options[specify_validation]"]' => array('checked' => TRUE))));
$plugins = Views::pluginManager('argument_validator')->getDefinitions();
foreach ($plugins as $id => $info) {
if (!empty($info['no_ui'])) {
continue;
}
$valid = TRUE;
if (!empty($info['type'])) {
$valid = FALSE;
if (empty($this->definition['validate type'])) {
continue;
}
foreach ((array) $info['type'] as $type) {
if ($type == $this->definition['validate type']) {
$valid = TRUE;
break;
}
}
}
// If we decide this validator is ok, add it to the list.
if ($valid) {
$plugin = $this->getPlugin('argument_validator', $id);
if ($plugin) {
if ($plugin->access() || $this->options['validate']['type'] == $id) {
// Sanitize ID for js.
$sanitized_id = static::encodeValidatorId($id);
$form['validate']['options'][$sanitized_id] = array('#prefix' => '<div id="edit-options-validate-options-' . $sanitized_id . '-wrapper">', '#suffix' => '</div>', '#type' => 'item', '#input' => TRUE, '#states' => array('visible' => array(':input[name="options[specify_validation]"]' => array('checked' => TRUE), ':input[name="options[validate][type]"]' => array('value' => $sanitized_id))), '#id' => 'edit-options-validate-options-' . $sanitized_id, '#default_value' => array());
$plugin->buildOptionsForm($form['validate']['options'][$sanitized_id], $form_state);
$validate_types[$sanitized_id] = $info['title'];
}
}
}
}
asort($validate_types);
$form['validate']['type']['#options'] = $validate_types;
$form['validate']['fail'] = array('#type' => 'select', '#title' => t('Action to take if filter value does not validate'), '#default_value' => $this->options['validate']['fail'], '#options' => $validate_options, '#states' => array('visible' => array(':input[name="options[specify_validation]"]' => array('checked' => TRUE))), '#fieldset' => 'argument_present');
}
示例5: buildOptionsForm
/**
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state)
{
parent::buildOptionsForm($form, $form_state);
unset($form['admin_label']['#fieldset']);
$form['admin_label']['#weight'] = -1;
$form['required'] = array('#type' => 'checkbox', '#title' => $this->t('Require this relationship'), '#description' => $this->t('Enable to hide items that do not contain this relationship'), '#default_value' => !empty($this->options['required']));
}