Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
67
vendor/chi-teck/drupal-code-generator/templates/d7/views-plugin/argument-default.twig
vendored
Normal file
67
vendor/chi-teck/drupal-code-generator/templates/d7/views-plugin/argument-default.twig
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains the {{ plugin_name }} argument default plugin.
|
||||
*
|
||||
* @DCG This file needs to be referenced from {{ machine_name }}.info using files[] directive.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Plugin description.
|
||||
*/
|
||||
class views_plugin_argument_{{ plugin_machine_name }} extends views_plugin_argument_default {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function option_definition() {
|
||||
$options = parent::option_definition();
|
||||
$options['example_option'] = array('default' => 15);
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function options_form(&$form, &$form_state) {
|
||||
$form['example_option'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Some example option.'),
|
||||
'#default_value' => $this->options['example_option'],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function options_validate(&$form, &$form_state) {
|
||||
if ($form_state['values']['options']['argument_default']['{{ plugin_machine_name }}']['example_option'] == 10) {
|
||||
form_error($form['example_option'], t('The value is not correct.'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function options_submit(&$form, &$form_state, &$options) {
|
||||
$options['example_option'] = $form_state['values']['options']['argument_default']['{{ plugin_machine_name }}']['example_option'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_argument() {
|
||||
|
||||
// @DCG
|
||||
// Here is the place where you should create a default argument for the
|
||||
// contextual filter. The source of this argument depends on your needs.
|
||||
// For example, you can extract the value from the URL or fetch it from
|
||||
// some fields of the current viewed entity.
|
||||
// For now lets use example option as an argument.
|
||||
$argument = $this->options['example_option'];
|
||||
|
||||
return $argument;
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue