Skip to content
action.module 3.6 KiB
Newer Older
<?php

/**
 * @file
 * This is the Actions module for executing stored actions.
 */

/**
 * Implements hook_help().
 */
function action_help($path, $arg) {
  switch ($path) {
    case 'admin/help#action':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The Action module provides tasks that can be executed by the site such as unpublishing content, sending e-mail messages, or blocking a user. Other modules can trigger these actions when specific system events happen; for example, when new content is posted or when a user logs in. Modules can also provide additional actions. For more information, see the <a href="!documentation">online documentation for the Action module</a>.', array('!documentation' => 'https://drupal.org/documentation/modules/action')) . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Using simple actions') . '</dt>';
      $output .= '<dd>' . t('<em>Simple actions</em> do not require configuration and are listed automatically as available on the <a href="!actions">Actions page</a>.', array('!actions' => \Drupal::url('action.admin'))) . '</dd>';
      $output .= '<dt>' . t('Creating and configuring advanced actions') . '</dt>';
      $output .= '<dd>' . t('<em>Advanced actions</em> are user-created and have to be configured individually. Create an advanced action on the <a href="!actions">Actions page</a> by selecting an action type from the drop-down list. Then configure your action, for example by specifying the recipient of an automated e-mail message.', array('!actions' => \Drupal::url('action.admin'))) . '</dd>';
      return $output;

    case 'admin/config/system/actions':
    case 'admin/config/system/actions/manage':
      $output = '<p>' . t('There are two types of actions: simple and advanced. Simple actions do not require any additional configuration and are listed here automatically. Advanced actions need to be created and configured before they can be used because they have options that need to be specified; for example, sending an e-mail to a specified address or unpublishing content containing certain words. To create an advanced action, select the action from the drop-down list in the advanced action section below and click the <em>Create</em> button.') . '</p>';
      return $output;

    case 'admin/config/system/actions/configure':
      return t('An advanced action offers additional configuration options which may be filled out below. Changing the <em>Description</em> field is recommended in order to better identify the precise action taking place.');
  }
}

/**
 * Implements hook_permission().
 */
function action_permission() {
  return array(
    'administer actions' => array(
      'title' => t('Administer actions'),
    ),
  );
}

/**
 * Implements hook_menu().
 */
function action_menu() {
  $items['admin/config/system/actions'] = array(
    'title' => 'Actions',
    'description' => 'Manage the actions defined for your site.',
 * Implements hook_entity_info().
function action_entity_info(&$entity_info) {
  $entity_info['action']['controllers']['form']['add'] = 'Drupal\action\ActionAddFormController';
  $entity_info['action']['controllers']['form']['edit'] = 'Drupal\action\ActionEditFormController';
  $entity_info['action']['controllers']['form']['delete'] = 'Drupal\action\Form\ActionDeleteForm';
  $entity_info['action']['controllers']['list'] = 'Drupal\action\ActionListController';
  $entity_info['action']['links']['edit-form'] = 'admin/config/system/actions/configure/{action}';