You are here

function metatag_modify_metatags_action_form in Metatag 7

The Views bulk operation configuration form for modifying metatags.

Parameters

array $context: Contextual information passed from the View bulk operation configuration form.

Return value

array A form API compatible array.

File

./metatag.module, line 342
Primary hook implementations for Metatag.

Code

function metatag_modify_metatags_action_form(array $context) {
  $form = array(
    '#entity_type' => $context['entity_type'],
  );

  // There can be multiple instances being edited here. So the 2nd param passed
  // here is as generic as possible.
  metatag_metatags_form($form, 'global');

  // Force the metatags tab to be fully visible and save a click from the user.
  $form['metatags']['#collapsed'] = FALSE;
  $form['metatags']['#collapsible'] = FALSE;

  // If we're reseting to the entity default, then we don't need to show the
  // form fields.
  $form['metatags']['#states'] = array(
    'visible' => array(
      ':input[name="reset_default"]' => array(
        'checked' => FALSE,
      ),
    ),
  );

  // Add an option to reset selected entities to the default configuration.
  $form['reset_default'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reset to metatag defaults'),
    '#default_value' => FALSE,
    '#description' => t('Check to <strong>fully reset all metatags</strong> on the entities being modified to their <a href="@settings">default configuration</a>.', array(
      '@settings' => url('admin/config/search/metatags'),
    )),
  );
  return $form;
}