X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Ftemplates%2Fmodule%2Fsrc%2FPlugin%2FViews%2Ffield%2Ffield.php.twig;fp=vendor%2Fdrupal%2Fconsole%2Ftemplates%2Fmodule%2Fsrc%2FPlugin%2FViews%2Ffield%2Ffield.php.twig;h=dba1baae6f1093b66ca3ceffa41397ce1727d7a4;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/drupal/console/templates/module/src/Plugin/Views/field/field.php.twig b/vendor/drupal/console/templates/module/src/Plugin/Views/field/field.php.twig new file mode 100644 index 000000000..dba1baae6 --- /dev/null +++ b/vendor/drupal/console/templates/module/src/Plugin/Views/field/field.php.twig @@ -0,0 +1,69 @@ +{% extends "base/class.php.twig" %} + +{% block file_path %} +\Drupal\{{module}}\Plugin\views\field\{{class_name}}. +{% endblock %} + +{% block namespace_class %} +namespace Drupal\{{module}}\Plugin\views\field; +{% endblock %} + +{% block use_class %} +use Drupal\Core\Form\FormStateInterface; +use Drupal\Component\Utility\Random; +use Drupal\views\Plugin\views\field\FieldPluginBase; +use Drupal\views\ResultRow; +{% endblock %} + +{% block class_declaration %} +/** + * A handler to provide a field that is completely custom by the administrator. + * + * @ingroup views_field_handlers + * + * @ViewsField("{{ class_machine_name }}") + */ +class {{ class_name }} extends FieldPluginBase {% endblock %} +{% block class_methods %} + /** + * {@inheritdoc} + */ + public function usesGroupBy() { + return FALSE; + } + + /** + * {@inheritdoc} + */ + public function query() { + // Do nothing -- to override the parent query. + } + + /** + * {@inheritdoc} + */ + protected function defineOptions() { + $options = parent::defineOptions(); + + $options['hide_alter_empty'] = ['default' => FALSE]; + return $options; + } + + /** + * {@inheritdoc} + */ + public function buildOptionsForm(&$form, FormStateInterface $form_state) { + parent::buildOptionsForm($form, $form_state); + } + + /** + * {@inheritdoc} + */ + public function render(ResultRow $values) { + // Return a random text, here you can include your custom logic. + // Include any namespace required to call the method required to generate + // the desired output. + $random = new Random(); + return $random->name(); + } +{% endblock %}