public function RulesComponentFormBase::entityTagsBuilder in Rules 8.3
Callback method for the #entity_builder form property.
Used to change format of tags from comma-separated values (as input) into an array (as stored in the the configuration entity).
Parameters
string $entity_type: The type of the entity.
\Drupal\Core\Config\Entity\ConfigEntityInterface $entity: The entity whose form is being built.
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- src/
Form/ RulesComponentFormBase.php, line 106
Class
- RulesComponentFormBase
- Provides the base form for rules add and edit forms.
Namespace
Drupal\rules\FormCode
public function entityTagsBuilder($entity_type, ConfigEntityInterface $entity, array $form, FormStateInterface $form_state) {
$tags = [];
$input_tags = $form_state
->getValue('keywords');
if (trim($input_tags) != '') {
$tags = array_map('trim', explode(',', $input_tags));
}
$entity
->set('tags', $tags);
}