You are here

public function FlowFormExpert::buildForm in CMS Content Sync 2.0.x

Same name and namespace in other branches
  1. 8 modules/cms_content_sync_developer/src/Form/FlowFormExpert.php \Drupal\cms_content_sync_developer\Form\FlowFormExpert::buildForm()

Parameters

array $form:

\Drupal\Core\Form\FormStateInterface $form_state:

Return value

array

Overrides FormInterface::buildForm

File

modules/cms_content_sync_developer/src/Form/FlowFormExpert.php, line 27

Class

FlowFormExpert
Content Sync Expert Flow creation form.

Namespace

Drupal\cms_content_sync_developer\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['name'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Name'),
    '#maxlength' => 255,
    '#description' => $this
      ->t("An administrative name describing the workflow intended to be achieved with this synchronization."),
    '#required' => TRUE,
  ];
  $form['id'] = [
    '#type' => 'machine_name',
    '#machine_name' => [
      'exists' => [
        $this,
        'exists',
      ],
      'source' => [
        'name',
      ],
    ],
  ];
  $form['type'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Flow type'),
    '#options' => [
      'push' => $this
        ->t('Push'),
      'pull' => $this
        ->t('Pull'),
    ],
    '#required' => TRUE,
  ];
  $description = 'One configuration per line separated by "|": <i>entity_type|bundle|pool|pool_usage|behavior</i>. <br>Example configuration: <br>
      <ul>
        <li>node|basic_page|content|force|automatically</li>
        <li>node|page|content|force|manually</li>
        <li>taxonomy_term|tags|content|allow|dependency</li>
      </ul>';
  $form['configuration'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Configuration'),
    '#required' => TRUE,
    '#rows' => 20,
    '#description' => $description,
  ];
  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Create flow'),
    '#button_type' => 'primary',
  ];
  return $form;
}