class FieldEntry in Flag 8.4
Class FieldEntry
Plugin annotation
@ActionLinkType(
id = "field_entry",
label = @Translation("Field Entry Form"),
description = @Translation("Redirects the user to a field entry form.")
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\flag\ActionLink\ActionLinkTypeBase implements ContainerFactoryPluginInterface, ActionLinkTypePluginInterface uses RedirectDestinationTrait, StringTranslationTrait
- class \Drupal\flag\Plugin\ActionLink\FormEntryTypeBase implements FormEntryInterface
- class \Drupal\flag\Plugin\ActionLink\FieldEntry
- class \Drupal\flag\Plugin\ActionLink\FormEntryTypeBase implements FormEntryInterface
- class \Drupal\flag\ActionLink\ActionLinkTypeBase implements ContainerFactoryPluginInterface, ActionLinkTypePluginInterface uses RedirectDestinationTrait, StringTranslationTrait
Expanded class hierarchy of FieldEntry
File
- src/
Plugin/ ActionLink/ FieldEntry.php, line 19
Namespace
Drupal\flag\Plugin\ActionLinkView source
class FieldEntry extends FormEntryTypeBase {
/**
* {@inheritdoc}
*/
public function getUrl($action, FlagInterface $flag, EntityInterface $entity) {
switch ($action) {
case 'flag':
return Url::fromRoute('flag.field_entry', [
'flag' => $flag
->id(),
'entity_id' => $entity
->id(),
]);
default:
return Url::fromRoute('flag.field_entry.edit', [
'flag' => $flag
->id(),
'entity_id' => $entity
->id(),
]);
}
}
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
$options = parent::defaultConfiguration();
// Change label for flag confirmation text.
$options['flag_confirmation'] = $this
->t('Enter flagging details');
$options['edit_flagging'] = $this
->t('Edit flagging details');
$options['flag_update_button'] = $this
->t('Update flagging');
return $options;
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['display']['settings']['link_options_' . $this
->getPluginId()]['edit_flagging'] = [
'#type' => 'textfield',
'#title' => $this
->t('Edit flagging details message'),
'#default_value' => $this->configuration['edit_flagging'],
'#description' => $this
->t('Message displayed if the user has clicked the "Edit flag" link. Usually presented in the form such as, "Please enter the flagging details."'),
// This will get changed to a state by flag_link_type_options_states().
'#required' => TRUE,
];
$form['display']['settings']['link_options_field_entry']['flag_update_button'] = [
'#type' => 'textfield',
'#title' => $this
->t('Update flagging button text'),
'#default_value' => $this->configuration['flag_update_button'],
'#description' => $this
->t('The text for the submit button when updating a flagging.'),
// This will get changed to a state by flag_link_type_options_states().
'#required' => TRUE,
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::validateConfigurationForm($form, $form_state);
$form_values = $form_state
->getValues();
if (empty($form_values['edit_flagging'])) {
$form_state
->setErrorByName('flagging_edit_title', $this
->t('An edit flagging details message is required when using the field entry link type.'));
}
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ActionLinkTypeBase:: |
protected | property | The current user. | |
ActionLinkTypeBase:: |
public | function | ||
ActionLinkTypeBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
1 |
ActionLinkTypeBase:: |
protected | function | Helper method to get the next flag action the user can take. | |
ActionLinkTypeBase:: |
public | function |
Get the action link as a Link object. Overrides ActionLinkTypePluginInterface:: |
|
ActionLinkTypeBase:: |
public | function |
Gets this plugin's configuration. Overrides ConfigurableInterface:: |
|
ActionLinkTypeBase:: |
protected | function | Helper method to generate a destination URL parameter. | 1 |
ActionLinkTypeBase:: |
public | function |
Sets the configuration for this plugin instance. Overrides ConfigurableInterface:: |
|
ActionLinkTypeBase:: |
public | function |
Build a new link type instance and sets the configuration. Overrides PluginBase:: |
1 |
FieldEntry:: |
public | function |
Provides a form array for the action link plugin's settings form. Overrides FormEntryTypeBase:: |
|
FieldEntry:: |
public | function |
Gets default configuration for this plugin. Overrides FormEntryTypeBase:: |
|
FieldEntry:: |
public | function |
Return a Url object for the given flag action. Overrides ActionLinkTypeBase:: |
|
FieldEntry:: |
public | function |
Validates the action link setting form. Overrides FormEntryTypeBase:: |
|
FormEntryTypeBase:: |
public | function |
Get the action link formatted for use in entity links. Overrides ActionLinkTypeBase:: |
|
FormEntryTypeBase:: |
public | function |
Returns the create button text. Overrides FormEntryInterface:: |
|
FormEntryTypeBase:: |
public | function |
Returns the delete button text. Overrides FormEntryInterface:: |
|
FormEntryTypeBase:: |
public | function |
Returns the edit flagging details form title. Overrides FormEntryInterface:: |
|
FormEntryTypeBase:: |
public | function |
Returns the flag confirm form question when flagging. Overrides FormEntryInterface:: |
|
FormEntryTypeBase:: |
public | function |
Returns the flag confirm form question when unflagging. Overrides FormEntryInterface:: |
|
FormEntryTypeBase:: |
public | function |
Returns the update button text. Overrides FormEntryInterface:: |
|
FormEntryTypeBase:: |
public | function |
Processes the action link setting form submit. Overrides ActionLinkTypeBase:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |