function action_example_node_sticky_action_form

Generates settings form for action_example_node_sticky_action().

Parameters

array $context: An array of options of this action (in case it is being edited)

Return value

array Settings form as Form API array.

See also

action_example_action_info()

Related topics

File

action_example/action_example.module, line 283

Code

function action_example_node_sticky_action_form($context) {
    
    /*
     * We return a configuration form to set the requirements that will
     * match this action before being executed. This is a regular Drupal form and
     * may include any type of information you want, but all the fields of the
     * form will be saved into the $context variable.
     *
     * In this case we are promoting all content types submitted by this user, but
     * it is possible to extend these conditions providing more options in the
     * settings form.
     */
    $form['author'] = array(
        '#title' => t('Author name'),
        '#type' => 'textfield',
        '#description' => t('Any content created, presaved or updated by this user will be promoted to front page and set as sticky.'),
        '#default_value' => isset($context['author']) ? $context['author'] : '',
    );
    // Verify user permissions and provide an easier way to fill this field.
    if (user_access('access user profiles')) {
        $form['author']['#autocomplete_path'] = 'user/autocomplete';
    }
    // No more options, return the form.
    return $form;
}