本文整理汇总了PHP中Drupal\views\Plugin\views\field\FieldPluginBase::init方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldPluginBase::init方法的具体用法?PHP FieldPluginBase::init怎么用?PHP FieldPluginBase::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\views\Plugin\views\field\FieldPluginBase
的用法示例。
在下文中一共展示了FieldPluginBase::init方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Override init function to provide generic option to link to shipment.
*/
public function init(&$view, &$data)
{
parent::init($view, $data);
if (!empty($this->options['link_to_shipment'])) {
$this->additional_fields['order_id'] = array('table' => $this->table_alias, 'field' => 'order_id');
}
}
示例2: init
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
if (!empty($options['link_to_file'])) {
$this->additional_fields['uri'] = 'uri';
}
}
示例3: init
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
if ($this->options['replace_variables']) {
$this->additional_fields['variables'] = 'variables';
}
}
示例4: init
/**
* Override init function to provide generic option to link to user.
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
if (!empty($this->options['link_to_user'])) {
$this->additional_fields['uid'] = array('table' => 'uc_orders', 'field' => 'uid');
}
}
示例5: init
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
$default_formats = array('yes-no' => array(t('Yes'), $this->t('No')), 'true-false' => array(t('True'), $this->t('False')), 'on-off' => array(t('On'), $this->t('Off')), 'enabled-disabled' => array(t('Enabled'), $this->t('Disabled')), 'boolean' => array(1, 0), 'unicode-yes-no' => array('✔', '✖'));
$output_formats = isset($this->definition['output formats']) ? $this->definition['output formats'] : array();
$custom_format = array('custom' => array(t('Custom')));
$this->formats = array_merge($default_formats, $output_formats, $custom_format);
}
示例6: init
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
// Don't add the additional fields to groupby
if (!empty($this->options['link_to_node'])) {
$this->additional_fields['nid'] = array('table' => 'node_field_data', 'field' => 'nid');
}
}
示例7: init
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
$this->format = $this->definition['format'];
$this->additional_fields = array();
if (is_array($this->format)) {
$this->additional_fields['format'] = $this->format;
}
}
示例8: init
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
$entity_type = $this->getEntityType();
// Filter the actions to only include those for this entity type.
$this->actions = array_filter($this->actionStorage->loadMultiple(), function ($action) use($entity_type) {
return $action->getType() == $entity_type;
});
}
示例9: init
/**
* Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::init().
*
* Provide generic option to link to comment.
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
if (!empty($this->options['link_to_comment'])) {
$this->additional_fields['cid'] = 'cid';
$this->additional_fields['entity_id'] = array('table' => 'comment_field_data', 'field' => 'entity_id');
$this->additional_fields['entity_type'] = array('table' => 'comment_field_data', 'field' => 'entity_type');
}
}
示例10: init
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
// Don't add the additional fields to groupby
if (!empty($this->options['link_to_feed'])) {
$this->additional_fields['fid'] = array('table' => 'feeds_feed', 'field' => 'fid');
if (module_exists('translation')) {
$this->additional_fields['langcode'] = array('table' => 'feeds_feed', 'field' => 'langcode');
}
}
}
示例11: init
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
$this->additional_fields[$this->definition['entity type field']] = $this->definition['entity type field'];
}
示例12: init
/**
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::init().
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
$this->additional_fields['tid'] = 'tid';
$this->additional_fields['vid'] = 'vid';
}
示例13: init
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
$this->multiple = FALSE;
$this->limit_values = FALSE;
$field_definition = $this->getFieldDefinition();
$cardinality = $field_definition->getFieldStorageDefinition()->getCardinality();
if ($field_definition->getFieldStorageDefinition()->isMultiple()) {
$this->multiple = TRUE;
// If "Display all values in the same row" is FALSE, then we always limit
// in order to show a single unique value per row.
if (!$this->options['group_rows']) {
$this->limit_values = TRUE;
}
// If "First and last only" is chosen, limit the values
if (!empty($this->options['delta_first_last'])) {
$this->limit_values = TRUE;
}
// Otherwise, we only limit values if the user hasn't selected "all", 0, or
// the value matching field cardinality.
if ($this->options['delta_limit'] > 0 && $this->options['delta_limit'] != $cardinality || intval($this->options['delta_offset'])) {
$this->limit_values = TRUE;
}
}
}
示例14: init
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
}