Drupal 修改Entity(ECK)默认的CRUD URL

function mymodule_entity_info_alter(&$entity_info) {

  if (isset($entity_info[myentity_type])) {
    // Rebuild entity crud url.
    $entity_info[myentity_type]['bundles'][mybundle]['crud'] = [
      'add' => ['path' => 'admin/content/mybundle/add'],
      'edit' => [
        'path' => 'admin/content/mybundle/%eckentity/edit',
        'entity_id' => 3, // Entity ID在URL上面的位置, 类似arg(3)
      ],
      'delete' => [
        'path' => 'admin/content/mybundle/%eckentity/delete',
        'entity_id' => 3,
      ],
      'view' => [
        'path' => 'admin/content/district/%eckentity/view',
        'entity_id' => 3,
      ]
    ];

    // admin url.
    $entity_info[myentity_type]['bundles']['mybundle']['admin']['path'] = 'admin/content/mybundle';
  }
}

Drupal 覆盖Region theme

创建theme_preprocess_region

function mytheme_preprocess_region(&$variables) {
  $region = $variables['region'];
  $classes = &$variables['classes_array'];

  // Content region.
  if ($region === 'header' && current_path() == 'node/1') {
    // @todo is this actually used properly?
    $variables['theme_hook_suggestions'][] = 'region__myheader__wrapper';
  }
}

创建模板region–myheader–wrapper.tpl.php

print $content;