FormStateInterface PHP Class Code Examples

This page contains top rated real world PHP examples of class FormStateInterface extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: StringFormatter.php Project: ddrozdik/dmaps
0
 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $form = parent::settingsForm($form, $form_state);
     $entity_type = $this->entityManager->getDefinition($this->fieldDefinition->getTargetEntityTypeId());
     $form['link_to_entity'] = ['#type' => 'checkbox', '#title' => $this->t('Link to the @entity_label', ['@entity_label' => $entity_type->getLabel()]), '#default_value' => $this->getSetting('link_to_entity')];
     return $form;
 }
Example #2
Show file File: FormTestBase.php Project: ddrozdik/dmaps
0
 /**
  * Simulates a form submission within a request, bypassing submitForm().
  *
  * Calling submitForm() will reset the form builder, if two forms were on the
  * same page, they will be submitted simultaneously.
  *
  * @param string $form_id
  *   The unique string identifying the form.
  * @param \Drupal\Core\Form\FormInterface $form_arg
  *   The form object.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  * @param bool $programmed
  *   Whether $form_state->setProgrammed() should be passed TRUE or not. If it
  *   is not set to TRUE, you must provide additional data in $form_state for
  *   the submission to take place.
  *
  * @return array
  *   The built form.
  */
 protected function simulateFormSubmission($form_id, FormInterface $form_arg, FormStateInterface $form_state, $programmed = TRUE)
 {
     $input = $form_state->getUserInput();
     $input['op'] = 'Submit';
     $form_state->setUserInput($input)->setProgrammed($programmed)->setSubmitted();
     return $this->formBuilder->buildForm($form_arg, $form_state);
 }
Example #3
Show file File: ConfigFormExampleConfigForm.php Project: selwynpolit/d8_test2
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $config = $this->config('configform_example.settings');
     $config->set('email_address', $form_state->getValue('email'));
     $config->save();
     return parent::submitForm($form, $form_state);
 }
Example #4
Show file File: WorkflowNodeNextStateAction.php Project: sedurzu/ildeposito8
0
 /**
  * {@inheritdoc}
  */
 public function buildConfigurationForm(array $form, FormStateInterface $form_state)
 {
     $form = parent::buildConfigurationForm($form, $form_state);
     // Remove to_sid. User can't set it, since we want a dynamic 'next' state.
     unset($form['to_sid']);
     return $form;
 }
Example #5
Show file File: ManyToOne.php Project: papillon-cendre/d8
0
 protected function valueForm(&$form, FormStateInterface $form_state)
 {
     parent::valueForm($form, $form_state);
     if (!$form_state->get('exposed')) {
         $this->helper->buildOptionsForm($form, $form_state);
     }
 }
Example #6
Show file File: TextItem.php Project: aWEBoLabs/taxi
0
 /**
  * {@inheritdoc}
  */
 public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data)
 {
     $element = array();
     $element['max_length'] = array('#type' => 'number', '#title' => t('Maximum length'), '#default_value' => $this->getSetting('max_length'), '#required' => TRUE, '#description' => t('The maximum length of the field in characters.'), '#min' => 1, '#disabled' => $has_data);
     $element += parent::storageSettingsForm($form, $form_state, $has_data);
     return $element;
 }
Example #7
Show file File: HelloBlock.php Project: narekcat/Drupal_module_example
0
 /**
  * {@inheritdoc}
  */
 public function blockForm($form, FormStateInterface $form_state)
 {
     $form = parent::blockForm($form, $form_state);
     $config = $this->getConfiguration();
     $form['hello_block_settings'] = array('#type' => 'textfield', '#title' => $this->t('Who'), '#description' => $this->t('Who do you want to say hello to?'), '#default_value' => isset($config['hello_block_settings']) ? $config['hello_block_settings'] : '');
     return $form;
 }
Example #8
Show file File: ContextDelete.php Project: Progressable/openway8
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state, $tempstore_id = NULL, $machine_name = NULL, $context_id = NULL)
 {
     $this->tempstore_id = $tempstore_id;
     $this->machine_name = $machine_name;
     $this->context_id = $context_id;
     return parent::buildForm($form, $form_state);
 }
Example #9
Show file File: ViewsBlock.php Project: aWEBoLabs/taxi
0
 /**
  * {@inheritdoc}
  */
 public function blockSubmit($form, FormStateInterface $form_state)
 {
     parent::blockSubmit($form, $form_state);
     if ($this->displaySet) {
         $this->view->display_handler->blockSubmit($this, $form, $form_state);
     }
 }
Example #10
Show file File: Date.php Project: ddrozdik/dmaps
0
 /**
  * Add an option to set the default value to the current date.
  */
 public function defaultArgumentForm(&$form, FormStateInterface $form_state)
 {
     parent::defaultArgumentForm($form, $form_state);
     $form['default_argument_type']['#options'] += array('date' => $this->t('Current date'));
     $form['default_argument_type']['#options'] += array('node_created' => $this->t("Current node's creation time"));
     $form['default_argument_type']['#options'] += array('node_changed' => $this->t("Current node's update time"));
 }
Example #11
Show file File: RulesComponentFormBase.php Project: Progressable/openway8
0
 /**
  * {@inheritdoc}
  */
 public function buildEntity(array $form, FormStateInterface $form_state)
 {
     $entity = parent::buildEntity($form, $form_state);
     $tags = array_map('trim', explode(',', $entity->get('tags')));
     $entity->set('tags', $tags);
     return $entity;
 }
Example #12
Show file File: MenuForm.php Project: eigentor/tommiblog
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     parent::submitForm($form, $form_state);
     if (!$this->entity->isNew() || $this->entity->isLocked()) {
         $this->submitOverviewForm($form, $form_state);
     }
 }
Example #13
Show file File: QueryParameter.php Project: aWEBoLabs/taxi
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['query_param'] = array('#type' => 'textfield', '#title' => $this->t('Query parameter'), '#description' => $this->t('The query parameter to use.'), '#default_value' => $this->options['query_param']);
     $form['fallback'] = array('#type' => 'textfield', '#title' => $this->t('Fallback value'), '#description' => $this->t('The fallback value to use when the above query parameter is not present.'), '#default_value' => $this->options['fallback']);
     $form['multiple'] = array('#type' => 'radios', '#title' => $this->t('Multiple values'), '#description' => $this->t('Conjunction to use when handling multiple values. E.g. "?value[0]=a&value[1]=b".'), '#default_value' => $this->options['multiple'], '#options' => array('and' => $this->t('AND'), 'or' => $this->t('OR')));
 }
Example #14
Show file File: ImageItem.php Project: eigentor/tommiblog
0
 /**
  * {@inheritdoc}
  */
 public function fieldSettingsForm(array $form, FormStateInterface $form_state)
 {
     // Get base form from FileItem.
     $element = parent::fieldSettingsForm($form, $form_state);
     $settings = $this->getSettings();
     // Add maximum and minimum resolution settings.
     $max_resolution = explode('x', $settings['max_resolution']) + array('', '');
     $element['max_resolution'] = array('#type' => 'item', '#title' => t('Maximum image resolution'), '#element_validate' => array(array(get_class($this), 'validateResolution')), '#weight' => 4.1, '#field_prefix' => '<div class="container-inline">', '#field_suffix' => '</div>', '#description' => t('The maximum allowed image size expressed as WIDTH×HEIGHT (e.g. 640×480). Leave blank for no restriction. If a larger image is uploaded, it will be resized to reflect the given width and height. Resizing images on upload will cause the loss of <a href="http://wikipedia.org/wiki/Exchangeable_image_file_format">EXIF data</a> in the image.'));
     $element['max_resolution']['x'] = array('#type' => 'number', '#title' => t('Maximum width'), '#title_display' => 'invisible', '#default_value' => $max_resolution[0], '#min' => 1, '#field_suffix' => ' × ');
     $element['max_resolution']['y'] = array('#type' => 'number', '#title' => t('Maximum height'), '#title_display' => 'invisible', '#default_value' => $max_resolution[1], '#min' => 1, '#field_suffix' => ' ' . t('pixels'));
     $min_resolution = explode('x', $settings['min_resolution']) + array('', '');
     $element['min_resolution'] = array('#type' => 'item', '#title' => t('Minimum image resolution'), '#element_validate' => array(array(get_class($this), 'validateResolution')), '#weight' => 4.2, '#field_prefix' => '<div class="container-inline">', '#field_suffix' => '</div>', '#description' => t('The minimum allowed image size expressed as WIDTH×HEIGHT (e.g. 640×480). Leave blank for no restriction. If a smaller image is uploaded, it will be rejected.'));
     $element['min_resolution']['x'] = array('#type' => 'number', '#title' => t('Minimum width'), '#title_display' => 'invisible', '#default_value' => $min_resolution[0], '#min' => 1, '#field_suffix' => ' × ');
     $element['min_resolution']['y'] = array('#type' => 'number', '#title' => t('Minimum height'), '#title_display' => 'invisible', '#default_value' => $min_resolution[1], '#min' => 1, '#field_suffix' => ' ' . t('pixels'));
     // Remove the description option.
     unset($element['description_field']);
     // Add title and alt configuration options.
     $element['alt_field'] = array('#type' => 'checkbox', '#title' => t('Enable <em>Alt</em> field'), '#default_value' => $settings['alt_field'], '#description' => t('The alt attribute may be used by search engines, screen readers, and when the image cannot be loaded. Enabling this field is recommended.'), '#weight' => 9);
     $element['alt_field_required'] = array('#type' => 'checkbox', '#title' => t('<em>Alt</em> field required'), '#default_value' => $settings['alt_field_required'], '#description' => t('Making this field required is recommended.'), '#weight' => 10, '#states' => array('visible' => array(':input[name="settings[alt_field]"]' => array('checked' => TRUE))));
     $element['title_field'] = array('#type' => 'checkbox', '#title' => t('Enable <em>Title</em> field'), '#default_value' => $settings['title_field'], '#description' => t('The title attribute is used as a tooltip when the mouse hovers over the image. Enabling this field is not recommended as it can cause problems with screen readers.'), '#weight' => 11);
     $element['title_field_required'] = array('#type' => 'checkbox', '#title' => t('<em>Title</em> field required'), '#default_value' => $settings['title_field_required'], '#weight' => 12, '#states' => array('visible' => array(':input[name="settings[title_field]"]' => array('checked' => TRUE))));
     // Add default_image element.
     static::defaultImageForm($element, $settings);
     $element['default_image']['#description'] = t("If no image is uploaded, this image will be shown on display and will override the field's default image.");
     return $element;
 }
Example #15
Show file File: ViewsMenuLinkForm.php Project: aWEBoLabs/taxi
0
 /**
  * {@inheritdoc}
  */
 public function extractFormValues(array &$form, FormStateInterface $form_state)
 {
     $definition = parent::extractFormValues($form, $form_state);
     $definition['title'] = $form_state->getValue('title');
     $definition['description'] = $form_state->getValue('description');
     return $definition;
 }
Example #16
Show file File: HtmlList.php Project: aWEBoLabs/taxi
0
 /**
  * Render the given style.
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['type'] = array('#type' => 'radios', '#title' => $this->t('List type'), '#options' => array('ul' => $this->t('Unordered list'), 'ol' => $this->t('Ordered list')), '#default_value' => $this->options['type']);
     $form['wrapper_class'] = array('#title' => $this->t('Wrapper class'), '#description' => $this->t('The class to provide on the wrapper, outside the list.'), '#type' => 'textfield', '#size' => '30', '#default_value' => $this->options['wrapper_class']);
     $form['class'] = array('#title' => $this->t('List class'), '#description' => $this->t('The class to provide on the list element itself.'), '#type' => 'textfield', '#size' => '30', '#default_value' => $this->options['class']);
 }
Example #17
Show file File: ProcessManager.php Project: frankcr/sftw8
0
 /**
  * Processes elements that have input groups.
  *
  * @param \Drupal\bootstrap\Utility\Element $element
  *   The element object.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  * @param array $complete_form
  *   The complete form structure.
  */
 protected static function processInputGroups(Element $element, FormStateInterface $form_state, array &$complete_form)
 {
     // Automatically inject the nearest button found after this element if
     // #input_group_button exists.
     if ($element->getProperty('input_group_button')) {
         // Obtain the parent array to limit search.
         $array_parents = $element->getProperty('array_parents', []);
         // Remove the current element from the array.
         array_pop($array_parents);
         // Retrieve the parent element.
         $parent = Element::create(NestedArray::getValue($complete_form, $array_parents), $form_state);
         // Find the closest button.
         if ($button = self::findButton($parent)) {
             $element->appendProperty('field_suffix', $button->setIcon());
             $button->setProperty('access', FALSE);
         }
     }
     $input_group_attributes = ['class' => ['input-group-' . ($element->getProperty('input_group_button') ? 'btn' : 'addon')]];
     if ($prefix = $element->getProperty('field_prefix')) {
         $element->setProperty('field_prefix', ['#type' => 'html_tag', '#tag' => 'span', '#attributes' => $input_group_attributes, '#value' => Element::create($prefix)->render(), '#weight' => -1]);
     }
     if ($suffix = $element->getProperty('field_suffix')) {
         $element->setProperty('field_suffix', ['#type' => 'html_tag', '#tag' => 'span', '#attributes' => $input_group_attributes, '#value' => Element::create($suffix)->render(), '#weight' => 1]);
     }
 }
Example #18
Show file File: EntityDisplayFormBase.php Project: eigentor/tommiblog
0
 /**
  * Form submission handler for multistep buttons.
  */
 public function multistepSubmit($form, FormStateInterface $form_state)
 {
     $trigger = $form_state->getTriggeringElement();
     $op = $trigger['#op'];
     switch ($op) {
         case 'edit':
             // Store the field whose settings are currently being edited.
             $field_name = $trigger['#field_name'];
             $form_state->set('plugin_settings_edit', $field_name);
             break;
         case 'update':
             // Set the field back to 'non edit' mode, and update $this->entity with
             // the new settings fro the next rebuild.
             $field_name = $trigger['#field_name'];
             $form_state->set('plugin_settings_edit', NULL);
             $form_state->set('plugin_settings_update', $field_name);
             $this->entity = $this->buildEntity($form, $form_state);
             break;
         case 'cancel':
             // Set the field back to 'non edit' mode.
             $form_state->set('plugin_settings_edit', NULL);
             break;
         case 'refresh_table':
             // If the currently edited field is one of the rows to be refreshed, set
             // it back to 'non edit' mode.
             $updated_rows = explode(' ', $form_state->getValue('refresh_rows'));
             $plugin_settings_edit = $form_state->get('plugin_settings_edit');
             if ($plugin_settings_edit && in_array($plugin_settings_edit, $updated_rows)) {
                 $form_state->set('plugin_settings_edit', NULL);
             }
             break;
     }
     $form_state->setRebuild();
 }
Example #19
Show file File: ZoneMemberZone.php Project: seongbae/drumo-distribution
0
 /**
  * {@inheritdoc}
  */
 public function submitConfigurationForm(array &$form, FormStateInterface $form_state)
 {
     parent::submitConfigurationForm($form, $form_state);
     if (!$form_state->getErrors()) {
         $this->configuration['zone'] = $form_state->getValue('zone');
     }
 }
Example #20
Show file File: StaticContextEditForm.php Project: neeravbm/unify-d8
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state, PageInterface $page = NULL, $name = '')
 {
     $form = parent::buildForm($form, $form_state, $page, $name);
     // The machine name of an existing context is read-only.
     $form['machine_name'] = array('#type' => 'value', '#value' => $name);
     return $form;
 }
Example #21
Show file File: DateFormatEditForm.php Project: neetumorwani/blogging
0
 /**
  * {@inheritdoc}
  */
 protected function actions(array $form, FormStateInterface $form_state)
 {
     $actions = parent::actions($form, $form_state);
     $actions['submit']['#value'] = t('Save format');
     unset($actions['delete']);
     return $actions;
 }
Example #22
Show file File: Display.php Project: eigentor/tommiblog
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $view = $form_state->get('view');
     $display_id = $form_state->get('display_id');
     $view->getExecutable()->displayHandlers->get($display_id)->submitOptionsForm($form['options'], $form_state);
     $view->cacheSet();
 }
Example #23
Show file File: ResponsiveImageStyleForm.php Project: aWEBoLabs/taxi
0
 /**
  * {@inheritdoc}
  */
 public function validateForm(array &$form, FormStateInterface $form_state)
 {
     parent::validateForm($form, $form_state);
     // Only validate on edit.
     if ($form_state->hasValue('keyed_styles')) {
         // Check if another breakpoint group is selected.
         if ($form_state->getValue('breakpoint_group') != $form_state->getCompleteForm()['breakpoint_group']['#default_value']) {
             // Remove the image style mappings since the breakpoint ID has changed.
             $form_state->unsetValue('keyed_styles');
         }
         // Check that at least 1 image style has been selected when using sizes.
         foreach ($form_state->getValue('keyed_styles') as $breakpoint_id => $multipliers) {
             foreach ($multipliers as $multiplier => $image_style_mapping) {
                 if ($image_style_mapping['image_mapping_type'] === 'sizes') {
                     if (empty($image_style_mapping['sizes'])) {
                         $form_state->setError($form['keyed_styles'][$breakpoint_id][$multiplier]['sizes'], 'Provide a value for the sizes attribute.');
                     }
                     if (empty(array_keys(array_filter($image_style_mapping['sizes_image_styles'])))) {
                         $form_state->setError($form['keyed_styles'][$breakpoint_id][$multiplier]['sizes_image_styles'], 'Select at least one image style.');
                     }
                 }
             }
         }
     }
 }
Example #24
Show file File: WorkflowTransitionListBuilder.php Project: sedurzu/ildeposito8
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     workflow_debug(__FILE__, __FUNCTION__, __LINE__);
     // @todo D8-port: still test this snippet.
     $form = parent::buildForm($form, $form_state);
     return $form;
 }
Example #25
Show file File: GroupwiseMax.php Project: eigentor/tommiblog
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     // Get the sorts that apply to our base.
     $sorts = Views::viewsDataHelper()->fetchFields($this->definition['base'], 'sort');
     $sort_options = array();
     foreach ($sorts as $sort_id => $sort) {
         $sort_options[$sort_id] = "{$sort['group']}: {$sort['title']}";
     }
     $base_table_data = Views::viewsData()->get($this->definition['base']);
     // Extends the relationship's basic options, allowing the user to pick a
     // sort and an order for it.
     $form['subquery_sort'] = array('#type' => 'select', '#title' => $this->t('Representative sort criteria'), '#default_value' => !empty($this->options['subquery_sort']) ? $this->options['subquery_sort'] : $this->definition['base'] . '.' . $base_table_data['table']['base']['field'], '#options' => $sort_options, '#description' => $this->t("The sort criteria is applied to the data brought in by the relationship to determine how a representative item is obtained for each row. For example, to show the most recent node for each user, pick 'Content: Updated date'."));
     $form['subquery_order'] = array('#type' => 'radios', '#title' => $this->t('Representative sort order'), '#description' => $this->t("The ordering to use for the sort criteria selected above."), '#options' => array('ASC' => $this->t('Ascending'), 'DESC' => $this->t('Descending')), '#default_value' => $this->options['subquery_order']);
     $form['subquery_namespace'] = array('#type' => 'textfield', '#title' => $this->t('Subquery namespace'), '#description' => $this->t('Advanced. Enter a namespace for the subquery used by this relationship.'), '#default_value' => $this->options['subquery_namespace']);
     // WIP: This stuff doesn't work yet: namespacing issues.
     // A list of suitable views to pick one as the subview.
     $views = array('' => '- None -');
     foreach (Views::getAllViews() as $view) {
         // Only get views that are suitable:
         // - base must the base that our relationship joins towards
         // - must have fields.
         if ($view->get('base_table') == $this->definition['base'] && !empty($view->getDisplay('default')['display_options']['fields'])) {
             // TODO: check the field is the correct sort?
             // or let users hang themselves at this stage and check later?
             $views[$view->id()] = $view->id();
         }
     }
     $form['subquery_view'] = array('#type' => 'select', '#title' => $this->t('Representative view'), '#default_value' => $this->options['subquery_view'], '#options' => $views, '#description' => $this->t('Advanced. Use another view to generate the relationship subquery. This allows you to use filtering and more than one sort. If you pick a view here, the sort options above are ignored. Your view must have the ID of its base as its only field, and should have some kind of sorting.'));
     $form['subquery_regenerate'] = array('#type' => 'checkbox', '#title' => $this->t('Generate subquery each time view is run'), '#default_value' => $this->options['subquery_regenerate'], '#description' => $this->t('Will re-generate the subquery for this relationship every time the view is run, instead of only when these options are saved. Use for testing if you are making changes elsewhere. WARNING: seriously impairs performance.'));
 }
Example #26
Show file File: NumericArgument.php Project: ddrozdik/dmaps
0
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     // allow + for or, , for and
     $form['break_phrase'] = array('#type' => 'checkbox', '#title' => $this->t('Allow multiple values'), '#description' => $this->t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'), '#default_value' => !empty($this->options['break_phrase']), '#group' => 'options][more');
     $form['not'] = array('#type' => 'checkbox', '#title' => $this->t('Exclude'), '#description' => $this->t('If selected, the numbers entered for the filter will be excluded rather than limiting the view.'), '#default_value' => !empty($this->options['not']), '#group' => 'options][more');
 }
Example #27
Show file File: SettingBase.php Project: frankcr/sftw8
0
 /**
  * {@inheritdoc}
  */
 public function getElement(array &$form, FormStateInterface $form_state)
 {
     // Construct the group elements.
     $group = $this->getGroup($form, $form_state);
     $plugin_id = $this->getPluginId();
     if (!isset($group->{$plugin_id})) {
         // Set properties from the plugin definition.
         foreach ($this->getElementProperties() as $name => $value) {
             $group->{$plugin_id}->setProperty($name, $value);
         }
         // Set default value from the stored form state value or theme setting.
         $default_value = $form_state->getValue($plugin_id, $this->theme->getSetting($plugin_id));
         $group->{$plugin_id}->setProperty('default_value', $default_value);
         // Append additional "see" link references to the description.
         $description = (string) $group->{$plugin_id}->getProperty('description') ?: '';
         /** @var \Drupal\Core\Render\Renderer $renderer */
         $renderer = \Drupal::service('renderer');
         $links = [];
         foreach ($this->pluginDefinition['see'] as $url => $title) {
             $link = ['#type' => 'link', '#url' => Url::fromUri($url), '#title' => $title, '#attributes' => ['target' => '_blank']];
             $links[] = (string) $renderer->render($link);
         }
         if (!empty($links)) {
             $description .= '<br>';
             $description .= t('See also:');
             $description .= ' ' . implode(', ', $links);
             $group->{$plugin_id}->setProperty('description', $description);
         }
     }
     return $group->{$plugin_id};
 }
Example #28
Show file File: CommentForm.php Project: HakS/drupal8_training
0
 /**
  * Form submission handler for the 'preview' action.
  *
  * @param $form
  *   An associative array containing the structure of the form.
  * @param $form_state
  *   The current state of the form.
  */
 public function preview(array &$form, FormStateInterface $form_state)
 {
     $comment_preview = comment_preview($this->entity, $form_state);
     $comment_preview['#title'] = $this->t('Preview comment');
     $form_state->set('comment_preview', $comment_preview);
     $form_state->setRebuild();
 }
Example #29
Show file File: ImageEffectEditForm.php Project: ddrozdik/dmaps
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state, ImageStyleInterface $image_style = NULL, $image_effect = NULL)
 {
     $form = parent::buildForm($form, $form_state, $image_style, $image_effect);
     $form['#title'] = $this->t('Edit %label effect', array('%label' => $this->imageEffect->label()));
     $form['actions']['submit']['#value'] = $this->t('Update effect');
     return $form;
 }