You are here

protected function XmlParser::configFormTableColumn in Feeds extensible parsers 8

Returns a form element for a specific column.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The current form state.

array $values: The individual source item values.

string $column: The name of the column.

string $machine_name: The machine name of the source.

Return value

array A single form element.

Overrides ParserBase::configFormTableColumn

1 call to XmlParser::configFormTableColumn()
QueryPathXmlParser::configFormTableColumn in src/Feeds/Parser/QueryPathXmlParser.php
Returns a form element for a specific column.
1 method overrides XmlParser::configFormTableColumn()
QueryPathXmlParser::configFormTableColumn in src/Feeds/Parser/QueryPathXmlParser.php
Returns a form element for a specific column.

File

src/Feeds/Parser/XmlParser.php, line 216

Class

XmlParser
Defines a XML parser using XPath.

Namespace

Drupal\feeds_ex\Feeds\Parser

Code

protected function configFormTableColumn(FormStateInterface $form_state, array $values, $column, $machine_name) {
  $id = 'feeds-ex-xml-raw-' . Html::escape($machine_name);
  switch ($column) {
    case 'raw':
      return [
        '#type' => 'checkbox',
        '#title' => $this
          ->t('Raw value'),
        '#title_display' => 'invisible',
        '#default_value' => (int) (!empty($values['raw'])),
        '#id' => $id,
      ];
    case 'inner':
      return [
        '#type' => 'checkbox',
        '#title' => $this
          ->t('Inner XML'),
        '#title_display' => 'invisible',
        '#default_value' => (int) (!empty($values['inner'])),
        '#states' => [
          'visible' => [
            '#' . $id => [
              'checked' => TRUE,
            ],
          ],
        ],
      ];
  }
}