You are here

function amp_get_formatted_status_list in Accelerated Mobile Pages (AMP) 7

Helper function to retrieve a formatted list of AMP-enabled content types.

1 call to amp_get_formatted_status_list()
amp_admin_form in ./amp.admin.inc
Form constructor for the AMP administration form.

File

./amp.admin.inc, line 248
Administrative page callbacks for the AMP module.

Code

function amp_get_formatted_status_list() {
  $enabled_types = amp_get_enabled_types();
  $node_types = node_type_get_names();
  $node_status_list = array();
  foreach ($node_types as $bundle => $label) {
    $configure = t('/admin/structure/types/manage/@bundle/display/amp?destination=/admin/config/content/amp', array(
      '@bundle' => $bundle,
    ));
    $enable_disable = t('/admin/structure/types/manage/@bundle/display?destination=/admin/config/content/amp', array(
      '@bundle' => $bundle,
    ));
    if (in_array($bundle, $enabled_types)) {
      $node_status_list[] = $label . t(' is <em>enabled</em>: <a href="@configure">Configure AMP view mode</a> or <a href="@enable_disable">Disable AMP display</a>', array(
        '@configure' => $configure,
        '@enable_disable' => $enable_disable,
      ));
    }
    else {
      $node_status_list[] = $label . t(' is <em>disabled</em>: <a href="@enable_disable">Enable AMP in Custom Display Settings</a>', array(
        '@enable_disable' => $enable_disable,
      ));
    }
  }
  return $node_status_list;
}