1 layout.admin.inc _layout_get_operations(Layout $layout)

Given a layout, return a list of operations that can be performed on it.

File

core/modules/layout/layout.admin.inc, line 238
Admin page callbacks for the Layout module.

Code

function _layout_get_operations(Layout $layout) {
  $links = array();
  if ($layout->disabled && !$layout->isDefault()) {
    $links['enable'] = array(
      'title' => t('Enable layout'),
      'href' => 'admin/structure/layouts/manage/' . $layout->name . '/enable',
      'query' => array('token' => backdrop_get_token('layout-' . $layout->name)),
    );
  }
  $links['edit'] = array(
    'title' => t('Manage blocks'),
    'href' => 'admin/structure/layouts/manage/' . $layout->name,
  );
  $links['settings'] = array(
    'title' => t('Configure layout'),
    'href' => 'admin/structure/layouts/manage/' . $layout->name . '/configure',
  );
  if (!$layout->isDefault()) {
    $links['clone'] = array(
      'title' => t('Clone layout'),
      'href' => 'admin/structure/layouts/manage/' . $layout->name . '/clone',
    );
    if (module_exists('config') && user_access('synchronize configuration')) {
      $links['export'] = array(
        'title' => t('Export layout'),
        'href' => 'admin/config/development/configuration/single/export',
        'query' => array(
          'group' => 'Layouts',
          'name' => 'layout.layout.' . $layout->name,
        ),
      );
    }
    if (!$layout->disabled) {
      $links['disable'] = array(
        'title' => t('Disable layout'),
        'href' => 'admin/structure/layouts/manage/' . $layout->name . '/disable',
        'query' => array('token' => backdrop_get_token('layout-' . $layout->name)),
      );
    }
    if ($layout->storage === LAYOUT_STORAGE_NORMAL) {
      $links['delete'] = array(
        'title' => t('Delete layout'),
        'href' => 'admin/structure/layouts/manage/' . $layout->name . '/delete',
      );
    }
  }

  if ($layout->storage === LAYOUT_STORAGE_OVERRIDE) {
    $links['revert'] = array(
      'title' => t('Revert layout'),
      'href' => 'admin/structure/layouts/manage/' . $layout->name . '/delete',
    );
  }

  return $links;
}