From 31c917ccea305abcb7e909f68f27590d880fc2e5 Mon Sep 17 00:00:00 2001 From: Valentine94 Date: Sat, 9 Jul 2016 15:19:00 +0300 Subject: [PATCH 1/8] Create initial docs templates --- docs/components/README.md | 3 +++ docs/functions/README.md | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 docs/components/README.md create mode 100644 docs/functions/README.md diff --git a/docs/components/README.md b/docs/components/README.md new file mode 100644 index 0000000..68a91f5 --- /dev/null +++ b/docs/components/README.md @@ -0,0 +1,3 @@ +# Template for a components. + +TBD diff --git a/docs/functions/README.md b/docs/functions/README.md new file mode 100644 index 0000000..4714d9f --- /dev/null +++ b/docs/functions/README.md @@ -0,0 +1,5 @@ +# Template for functions. + +{{START}} + +{{END}} From b2d53ae4c0cd9cd193fbbed88d363e1edd483d76 Mon Sep 17 00:00:00 2001 From: Valentine94 Date: Sat, 9 Jul 2016 15:59:12 +0300 Subject: [PATCH 2/8] Create template for functions --- docs/functions/README.md | 47 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/docs/functions/README.md b/docs/functions/README.md index 4714d9f..682034e 100644 --- a/docs/functions/README.md +++ b/docs/functions/README.md @@ -1,5 +1,46 @@ -# Template for functions. +Template for functions. +======================= +### Document structure: +1. Signature +2. Short description +3. Long description(if exists) +4. Arguments description +5. Return statement description(if returns something) +6. Code -{{START}} +### Example: -{{END}} +function **my_function(array $arg1, $arg2 = NULL)** + +> This function allow users(short description).... + +> Additional info for this function(long description). + +> * **$arg1**: + type: _array_ + description: + _Argument 1 description._ +> * **$arg2**: + type: _string_ + default: NULL + description: + _Argument 2 description._ + +> * **return**: + type: _object_ + description: + _Return some object._ + +**Code:** +```php +function my_function(array $arg1, $arg2 = NULL) { + $object = new stdClass(); + foreach($arg1 as $name => $value) { + $object->{$name} = $value; + } + if (!empty($arg2)) { + $object->arg = $arg2; + } + return $object; +} +``` From a0b5047f926edd4de91ff365250dd429033d4b21 Mon Sep 17 00:00:00 2001 From: Valentine94 Date: Sat, 9 Jul 2016 16:16:31 +0300 Subject: [PATCH 3/8] Fix the style for the functions template --- docs/functions/README.md | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/docs/functions/README.md b/docs/functions/README.md index 682034e..57918e9 100644 --- a/docs/functions/README.md +++ b/docs/functions/README.md @@ -16,20 +16,17 @@ function **my_function(array $arg1, $arg2 = NULL)** > Additional info for this function(long description). -> * **$arg1**: - type: _array_ - description: - _Argument 1 description._ -> * **$arg2**: - type: _string_ - default: NULL - description: - _Argument 2 description._ +* **$arg1**: +    type: _array_ +    description: _Argument 1 description._ +* **$arg2**: +    type: _string_ +    default: _NULL_ +    description: _Argument 2 description._ -> * **return**: - type: _object_ - description: - _Return some object._ +* **return**: +    type: _object_ +    description: _Return some object._ **Code:** ```php From f45cd19deab0d62e20a1ec8175e948e85f9b7973 Mon Sep 17 00:00:00 2001 From: Valentine94 Date: Sat, 9 Jul 2016 16:17:28 +0300 Subject: [PATCH 4/8] Fix the style for the functions template --- docs/functions/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/functions/README.md b/docs/functions/README.md index 57918e9..16ece44 100644 --- a/docs/functions/README.md +++ b/docs/functions/README.md @@ -16,16 +16,16 @@ function **my_function(array $arg1, $arg2 = NULL)** > Additional info for this function(long description). -* **$arg1**: -    type: _array_ +* **$arg1**:\ +    type: _array_\     description: _Argument 1 description._ -* **$arg2**: -    type: _string_ -    default: _NULL_ +* **$arg2**:\ +    type: _string_\ +    default: _NULL_\     description: _Argument 2 description._ -* **return**: -    type: _object_ +* **return**:\ +    type: _object_\     description: _Return some object._ **Code:** From 85a0131cbf2ee04465fb0ce151e14745e30afbf2 Mon Sep 17 00:00:00 2001 From: Valentine94 Date: Sat, 9 Jul 2016 16:24:33 +0300 Subject: [PATCH 5/8] Fix the style for the functions template --- docs/functions/README.md | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/docs/functions/README.md b/docs/functions/README.md index 16ece44..824bf4c 100644 --- a/docs/functions/README.md +++ b/docs/functions/README.md @@ -16,17 +16,25 @@ function **my_function(array $arg1, $arg2 = NULL)** > Additional info for this function(long description). -* **$arg1**:\ -    type: _array_\ -    description: _Argument 1 description._ -* **$arg2**:\ -    type: _string_\ -    default: _NULL_\ -    description: _Argument 2 description._ - -* **return**:\ -    type: _object_\ -    description: _Return some object._ +* **$arg1**: + +        type: _array_ + +        description: _Argument 1 description._ + +* **$arg2**: + +        type: _string_ + +        default: _NULL_ + +        description: _Argument 2 description._ + +* **return**: + +        type: _object_ + +        description: _Return some object._ **Code:** ```php From b3706819c369d1711ad3bdcd0d1115d9f639fc5d Mon Sep 17 00:00:00 2001 From: Valentine94 Date: Sat, 9 Jul 2016 16:25:40 +0300 Subject: [PATCH 6/8] Fix the style for the functions template --- docs/functions/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/functions/README.md b/docs/functions/README.md index 824bf4c..a76b9b8 100644 --- a/docs/functions/README.md +++ b/docs/functions/README.md @@ -4,7 +4,7 @@ Template for functions. 1. Signature 2. Short description 3. Long description(if exists) -4. Arguments description +4. Arguments description(if exists) 5. Return statement description(if returns something) 6. Code From c82c84bab8456f45d7b68ba34c3d79a6f3c8b91a Mon Sep 17 00:00:00 2001 From: Valentine94 Date: Sat, 9 Jul 2016 17:05:44 +0300 Subject: [PATCH 7/8] Prepare components template --- docs/components/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/components/README.md b/docs/components/README.md index 68a91f5..b1ead2d 100644 --- a/docs/components/README.md +++ b/docs/components/README.md @@ -1,3 +1,5 @@ -# Template for a components. +Template for a components. +========================== +### Document structure: -TBD +### Example: From f2a0308928eb1253452120a1a9593bbbb573fe41 Mon Sep 17 00:00:00 2001 From: Valentine94 Date: Sun, 10 Jul 2016 13:52:44 +0300 Subject: [PATCH 8/8] Create functions docs for 8.1.x, started with 'a' char --- .../src/8.1.x/action_entity_type_build.md | 18 ++++++ docs/functions/src/8.1.x/action_help.md | 30 ++++++++++ .../8.1.x/action_views_form_substitutions.md | 17 ++++++ docs/functions/src/8.1.x/aggregator_cron.md | 34 ++++++++++++ .../aggregator_entity_extra_field_info.md | 55 +++++++++++++++++++ docs/functions/src/8.1.x/aggregator_help.md | 51 +++++++++++++++++ .../src/8.1.x/aggregator_preprocess_block.md | 12 ++++ .../src/8.1.x/aggregator_requirements.md | 20 +++++++ docs/functions/src/8.1.x/aggregator_theme.md | 19 +++++++ ...test_advanced_commands_add_css_callback.md | 12 ++++ ...s_test_advanced_commands_after_callback.md | 14 +++++ ...s_test_advanced_commands_alert_callback.md | 12 ++++ ..._test_advanced_commands_append_callback.md | 13 +++++ ..._test_advanced_commands_before_callback.md | 13 +++++ ...nced_commands_changed_asterisk_callback.md | 12 ++++ ...test_advanced_commands_changed_callback.md | 12 ++++ ...rms_test_advanced_commands_css_callback.md | 15 +++++ ...ms_test_advanced_commands_data_callback.md | 13 +++++ ...ms_test_advanced_commands_html_callback.md | 12 ++++ ..._test_advanced_commands_insert_callback.md | 12 ++++ ..._test_advanced_commands_invoke_callback.md | 12 ++++ ...test_advanced_commands_prepend_callback.md | 12 ++++ ..._test_advanced_commands_remove_callback.md | 12 ++++ ...est_advanced_commands_restripe_callback.md | 12 ++++ ...est_advanced_commands_settings_callback.md | 13 +++++ .../ajax_forms_test_lazy_load_form_ajax.md | 20 +++++++ ...jax_forms_test_validation_form_callback.md | 12 ++++ ...ms_test_validation_number_form_callback.md | 12 ++++ .../src/8.1.x/archiver_get_archiver.md | 23 ++++++++ .../src/8.1.x/archiver_get_extensions.md | 24 ++++++++ .../src/8.1.x/authorize_access_allowed.md | 24 ++++++++ ...ed_cron_form_system_cron_settings_alter.md | 38 +++++++++++++ .../src/8.1.x/automated_cron_help.md | 23 ++++++++ .../8.1.x/automated_cron_settings_submit.md | 13 +++++ 34 files changed, 646 insertions(+) create mode 100644 docs/functions/src/8.1.x/action_entity_type_build.md create mode 100644 docs/functions/src/8.1.x/action_help.md create mode 100644 docs/functions/src/8.1.x/action_views_form_substitutions.md create mode 100644 docs/functions/src/8.1.x/aggregator_cron.md create mode 100644 docs/functions/src/8.1.x/aggregator_entity_extra_field_info.md create mode 100644 docs/functions/src/8.1.x/aggregator_help.md create mode 100644 docs/functions/src/8.1.x/aggregator_preprocess_block.md create mode 100644 docs/functions/src/8.1.x/aggregator_requirements.md create mode 100644 docs/functions/src/8.1.x/aggregator_theme.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_add_css_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_after_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_alert_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_append_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_before_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_changed_asterisk_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_changed_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_css_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_data_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_html_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_insert_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_invoke_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_prepend_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_remove_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_restripe_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_settings_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_lazy_load_form_ajax.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_validation_form_callback.md create mode 100644 docs/functions/src/8.1.x/ajax_forms_test_validation_number_form_callback.md create mode 100644 docs/functions/src/8.1.x/archiver_get_archiver.md create mode 100644 docs/functions/src/8.1.x/archiver_get_extensions.md create mode 100644 docs/functions/src/8.1.x/authorize_access_allowed.md create mode 100644 docs/functions/src/8.1.x/automated_cron_form_system_cron_settings_alter.md create mode 100644 docs/functions/src/8.1.x/automated_cron_help.md create mode 100644 docs/functions/src/8.1.x/automated_cron_settings_submit.md diff --git a/docs/functions/src/8.1.x/action_entity_type_build.md b/docs/functions/src/8.1.x/action_entity_type_build.md new file mode 100644 index 0000000..baadc85 --- /dev/null +++ b/docs/functions/src/8.1.x/action_entity_type_build.md @@ -0,0 +1,18 @@ +function **action_entity_type_build(array &$entity_types)** + +> Implements hook_entity_type_build(). + +**Code:** +```php +function action_entity_type_build(array &$entity_types) { + /** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */ + $entity_types['action'] + ->setFormClass('add', 'Drupal\action\ActionAddForm') + ->setFormClass('edit', 'Drupal\action\ActionEditForm') + ->setFormClass('delete', 'Drupal\action\Form\ActionDeleteForm') + ->setListBuilderClass('Drupal\action\ActionListBuilder') + ->setLinkTemplate('delete-form', '/admin/config/system/actions/configure/{action}/delete') + ->setLinkTemplate('edit-form', '/admin/config/system/actions/configure/{action}') + ->setLinkTemplate('collection', '/admin/config/system/actions'); +} +``` diff --git a/docs/functions/src/8.1.x/action_help.md b/docs/functions/src/8.1.x/action_help.md new file mode 100644 index 0000000..3b2ec10 --- /dev/null +++ b/docs/functions/src/8.1.x/action_help.md @@ -0,0 +1,30 @@ +function **action_help($route_name, RouteMatchInterface $route_match)** + +> Implements hook_help(). + +**Code:** +```php +function action_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + case 'help.page.action': + $output = ''; + $output .= '

' . t('About') . '

'; + $output .= '

' . t('The Actions module provides tasks that can be executed by the site such as unpublishing content, sending email 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 online documentation for the Actions module.', array(':documentation' => 'https://www.drupal.org/documentation/modules/action')) . '

'; + $output .= '

' . t('Uses') . '

'; + $output .= '
'; + $output .= '
' . t('Using simple actions') . '
'; + $output .= '
' . t('Simple actions do not require configuration and are listed automatically as available on the Actions page.', array(':actions' => \Drupal::url('entity.action.collection'))) . '
'; + $output .= '
' . t('Creating and configuring advanced actions') . '
'; + $output .= '
' . t('Advanced actions are user-created and have to be configured individually. Create an advanced action on the Actions page by selecting an action type from the drop-down list. Then configure your action, for example by specifying the recipient of an automated email message.', array(':actions' => \Drupal::url('entity.action.collection'))) . '
'; + $output .= '
'; + return $output; + + case 'entity.action.collection': + $output = '

' . 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 email 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 Create button.') . '

'; + return $output; + + case 'entity.action.edit_form': + return t('An advanced action offers additional configuration options which may be filled out below. Changing the Description field is recommended in order to better identify the precise action taking place.'); + } +} +``` diff --git a/docs/functions/src/8.1.x/action_views_form_substitutions.md b/docs/functions/src/8.1.x/action_views_form_substitutions.md new file mode 100644 index 0000000..1f7d8e4 --- /dev/null +++ b/docs/functions/src/8.1.x/action_views_form_substitutions.md @@ -0,0 +1,17 @@ +function **action_views_form_substitutions()** + +> Implements hook_views_form_substitutions(). + +**Code:** +```php +function action_views_form_substitutions() { + $select_all = array( + '#type' => 'checkbox', + '#default_value' => FALSE, + '#attributes' => array('class' => array('action-table-select-all')), + ); + return array( + '' => drupal_render($select_all), + ); +} +``` diff --git a/docs/functions/src/8.1.x/aggregator_cron.md b/docs/functions/src/8.1.x/aggregator_cron.md new file mode 100644 index 0000000..808203d --- /dev/null +++ b/docs/functions/src/8.1.x/aggregator_cron.md @@ -0,0 +1,34 @@ +function **aggregator_cron()** + +> Implements hook_cron(). + +> Queues news feeds for updates once their refresh interval has elapsed. + +**Code:** +```php +function aggregator_cron() { + $queue = \Drupal::queue('aggregator_feeds'); + + $ids = \Drupal::entityManager()->getStorage('aggregator_feed')->getFeedIdsToRefresh(); + foreach (Feed::loadMultiple($ids) as $feed) { + if ($queue->createItem($feed)) { + // Add timestamp to avoid queueing item more than once. + $feed->setQueuedTime(REQUEST_TIME); + $feed->save(); + } + } + + // Delete queued timestamp after 6 hours assuming the update has failed. + $ids = \Drupal::entityQuery('aggregator_feed') + ->condition('queued', REQUEST_TIME - (3600 * 6), '<') + ->execute(); + + if ($ids) { + $feeds = Feed::loadMultiple($ids); + foreach ($feeds as $feed) { + $feed->setQueuedTime(0); + $feed->save(); + } + } +} +``` diff --git a/docs/functions/src/8.1.x/aggregator_entity_extra_field_info.md b/docs/functions/src/8.1.x/aggregator_entity_extra_field_info.md new file mode 100644 index 0000000..f82bddf --- /dev/null +++ b/docs/functions/src/8.1.x/aggregator_entity_extra_field_info.md @@ -0,0 +1,55 @@ +function **aggregator_entity_extra_field_info()** + +> Implements hook_entity_extra_field_info(). + +**Code:** +```php +function aggregator_entity_extra_field_info() { + $extra = array(); + + $extra['aggregator_feed']['aggregator_feed'] = array( + 'display' => array( + 'items' => array( + 'label' => t('Items'), + 'description' => t('Items associated with this feed'), + 'weight' => 0, + ), + // @todo Move to a formatter at https://www.drupal.org/node/2339917. + 'image' => array( + 'label' => t('Image'), + 'description' => t('The feed image'), + 'weight' => 2, + ), + // @todo Move to a formatter at https://www.drupal.org/node/2149845. + 'description' => array( + 'label' => t('Description'), + 'description' => t('The description of this feed'), + 'weight' => 3, + ), + 'more_link' => array( + 'label' => t('More link'), + 'description' => t('A more link to the feed detail page'), + 'weight' => 5, + ), + 'feed_icon' => array( + 'label' => t('Feed icon'), + 'description' => t('An icon that links to the feed URL'), + 'weight' => 6, + ), + ), + ); + + $extra['aggregator_item']['aggregator_item'] = array( + 'display' => array( + // @todo Move to a formatter at https://www.drupal.org/node/2149845. + 'description' => array( + 'label' => t('Description'), + 'description' => t('The description of this feed item'), + 'weight' => 2, + ), + ), + ); + + return $extra; +} +``` diff --git a/docs/functions/src/8.1.x/aggregator_help.md b/docs/functions/src/8.1.x/aggregator_help.md new file mode 100644 index 0000000..a6b0856 --- /dev/null +++ b/docs/functions/src/8.1.x/aggregator_help.md @@ -0,0 +1,51 @@ +function **aggregator_help($route_name, RouteMatchInterface $route_match)** + +> Implements hook_help(). + +**Code:** +```php +function aggregator_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + case 'help.page.aggregator': + $path_validator = \Drupal::pathValidator(); + $output = ''; + $output .= '

' . t('About') . '

'; + $output .= '

' . t('The Aggregator module is an on-site syndicator and news reader that gathers and displays fresh content from RSS-, RDF-, and Atom-based feeds made available across the web. Thousands of sites (particularly news sites and blogs) publish their latest headlines in feeds, using a number of standardized XML-based formats. For more information, see the online documentation for the Aggregator module.', array(':aggregator-module' => 'https://www.drupal.org/documentation/modules/aggregator')) . '

'; + $output .= '

' . t('Uses') . '

'; + $output .= '
'; + // Check if the aggregator sources View is enabled. + if ($url = $path_validator->getUrlIfValid('aggregator/sources')) { + $output .= '
' . t('Viewing feeds') . '
'; + $output .= '
' . t('Users view feed content in the main aggregator display, or by their source (usually via an RSS feed reader). The most recent content in a feed can be displayed as a block through the Blocks administration page.', array(':aggregator' => \Drupal::url('aggregator.page_last'), ':aggregator-sources' => $url->toString(), ':admin-block' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#')) . '
'; + } + $output .= '
' . t('Adding, editing, and deleting feeds') . '
'; + $output .= '
' . t('Administrators can add, edit, and delete feeds, and choose how often to check each feed for newly updated items on the Feed aggregator page.', array(':feededit' => \Drupal::url('aggregator.admin_overview'))) . '
'; + $output .= '
' . t('Configuring the display of feed items') . '
'; + $output .= '
' . t('Administrators can choose how many items are displayed in the listing pages, which HTML tags are allowed in the content of feed items, and whether they should be trimmed to a maximum number of characters on the Feed aggregator settings page.', array(':settings' => \Drupal::url('aggregator.admin_settings'))) . '
'; + $output .= '
' . t('Discarding old feed items') . '
'; + $output .= '
' . t('Administrators can choose whether to discard feed items that are older than a specified period of time on the Feed aggregator settings page. This requires a correctly configured cron maintenance task (see below).', array(':settings' => \Drupal::url('aggregator.admin_settings'))) . '
'; + + $output .= '
' . t('OPML integration') . '
'; + // Check if the aggregator opml View is enabled. + if ($url = $path_validator->getUrlIfValid('aggregator/opml')) { + $output .= '
' . t('A machine-readable OPML file of all feeds is available. OPML is an XML-based file format used to share outline-structured information such as a list of RSS feeds. Feeds can also be imported via an OPML file.', array(':aggregator-opml' => $url->toString(), ':import-opml' => \Drupal::url('aggregator.opml_add'))) . '
'; + } + $output .= '
' . t('Configuring cron') . '
'; + $output .= '
' . t('A working cron maintenance task is required to update feeds automatically.', array(':cron' => \Drupal::url('system.cron_settings'))) . '
'; + $output .= '
'; + return $output; + + case 'aggregator.admin_overview': + // Don't use placeholders for possibility to change URLs for translators. + $output = '

' . t('Many sites publish their headlines and posts in feeds, using a number of standardized XML-based formats. The aggregator supports RSS, RDF, and Atom.') . '

'; + $output .= '

' . t('Current feeds are listed below, and new feeds may be added. For each feed, the latest items block may be enabled at the blocks administration page.', array(':addfeed' => \Drupal::url('aggregator.feed_add'), ':block' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#')) . '

'; + return $output; + + case 'aggregator.feed_add': + return '

' . t('Add a feed in RSS, RDF or Atom format. A feed may only have one entry.') . '

'; + + case 'aggregator.opml_add': + return '

' . t('OPML is an XML format for exchanging feeds between aggregators. A single OPML document may contain many feeds. Aggregator uses this file to import all feeds at once. Upload a file from your computer or enter a URL where the OPML file can be downloaded.') . '

'; + } +} +``` diff --git a/docs/functions/src/8.1.x/aggregator_preprocess_block.md b/docs/functions/src/8.1.x/aggregator_preprocess_block.md new file mode 100644 index 0000000..3706f35 --- /dev/null +++ b/docs/functions/src/8.1.x/aggregator_preprocess_block.md @@ -0,0 +1,12 @@ +function **aggregator_preprocess_block(&$variables)** + +> Implements hook_preprocess_HOOK() for block templates. + +**Code:** +```php +function aggregator_preprocess_block(&$variables) { + if ($variables['configuration']['provider'] == 'aggregator') { + $variables['attributes']['role'] = 'complementary'; + } +} +``` diff --git a/docs/functions/src/8.1.x/aggregator_requirements.md b/docs/functions/src/8.1.x/aggregator_requirements.md new file mode 100644 index 0000000..9238911 --- /dev/null +++ b/docs/functions/src/8.1.x/aggregator_requirements.md @@ -0,0 +1,20 @@ +function **aggregator_requirements($phase)** + +> Implements hook_requirements(). + +**Code:** +```php +function aggregator_requirements($phase) { + $has_curl = function_exists('curl_init'); + $requirements = array(); + $requirements['curl'] = array( + 'title' => t('cURL'), + 'value' => $has_curl ? t('Enabled') : t('Not found'), + ); + if (!$has_curl) { + $requirements['curl']['severity'] = REQUIREMENT_ERROR; + $requirements['curl']['description'] = t('The Aggregator module could not be installed because the PHP cURL library is not available.'); + } + return $requirements; +} +``` diff --git a/docs/functions/src/8.1.x/aggregator_theme.md b/docs/functions/src/8.1.x/aggregator_theme.md new file mode 100644 index 0000000..f05b5d1 --- /dev/null +++ b/docs/functions/src/8.1.x/aggregator_theme.md @@ -0,0 +1,19 @@ +function **aggregator_theme()** + +> Implements hook_theme(). + +**Code:** +```php +function aggregator_theme() { + return array( + 'aggregator_feed' => array( + 'render element' => 'elements', + 'file' => 'aggregator.theme.inc', + ), + 'aggregator_item' => array( + 'render element' => 'elements', + 'file' => 'aggregator.theme.inc', + ), + ); +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_add_css_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_add_css_callback.md new file mode 100644 index 0000000..02449b9 --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_add_css_callback.md @@ -0,0 +1,12 @@ +function **ajax_forms_test_advanced_commands_add_css_callback($form, FormStateInterface $form_state)** + +> Ajax callback for 'add_css'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_add_css_callback($form, FormStateInterface $form_state) { + $response = new AjaxResponse(); + $response->addCommand(new AddCssCommand('my/file.css')); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_after_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_after_callback.md new file mode 100644 index 0000000..74b4472 --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_after_callback.md @@ -0,0 +1,14 @@ +function **ajax_forms_test_advanced_commands_after_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'after'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_after_callback($form, FormStateInterface $form_state) { + $selector = '#after_div'; + + $response = new AjaxResponse(); + $response->addCommand(new AfterCommand($selector, "This will be placed after")); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_alert_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_alert_callback.md new file mode 100644 index 0000000..798d3d0 --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_alert_callback.md @@ -0,0 +1,12 @@ +function **ajax_forms_test_advanced_commands_alert_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'alert'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_alert_callback($form, FormStateInterface $form_state) { + $response = new AjaxResponse(); + $response->addCommand(new AlertCommand('Alert')); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_append_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_append_callback.md new file mode 100644 index 0000000..eec64af --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_append_callback.md @@ -0,0 +1,13 @@ +function **ajax_forms_test_advanced_commands_append_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'append'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_append_callback($form, FormStateInterface $form_state) { + $selector = '#append_div'; + $response = new AjaxResponse(); + $response->addCommand(new AppendCommand($selector, "Appended text")); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_before_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_before_callback.md new file mode 100644 index 0000000..1b6d366 --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_before_callback.md @@ -0,0 +1,13 @@ +function **ajax_forms_test_advanced_commands_before_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'before'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_before_callback($form, FormStateInterface $form_state) { + $selector = '#before_div'; + $response = new AjaxResponse(); + $response->addCommand(new BeforeCommand($selector, "Before text")); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_changed_asterisk_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_changed_asterisk_callback.md new file mode 100644 index 0000000..46328e2 --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_changed_asterisk_callback.md @@ -0,0 +1,12 @@ +function **ajax_forms_test_advanced_commands_changed_asterisk_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'changed' with asterisk marking inner div. + +**Code:** +```php +function ajax_forms_test_advanced_commands_changed_asterisk_callback($form, FormStateInterface $form_state) { + $response = new AjaxResponse(); + $response->addCommand(new ChangedCommand('#changed_div', '#changed_div_mark_this')); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_changed_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_changed_callback.md new file mode 100644 index 0000000..fde96da --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_changed_callback.md @@ -0,0 +1,12 @@ +function **ajax_forms_test_advanced_commands_changed_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'changed'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_changed_callback($form, FormStateInterface $form_state) { + $response = new AjaxResponse(); + $response->addCommand(new ChangedCommand('#changed_div')); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_css_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_css_callback.md new file mode 100644 index 0000000..2ef46b3 --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_css_callback.md @@ -0,0 +1,15 @@ +function **ajax_forms_test_advanced_commands_css_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'css'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_css_callback($form, FormStateInterface $form_state) { + $selector = '#css_div'; + $color = 'blue'; + + $response = new AjaxResponse(); + $response->addCommand(new CssCommand($selector, array('background-color' => $color))); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_data_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_data_callback.md new file mode 100644 index 0000000..5af9f4f --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_data_callback.md @@ -0,0 +1,13 @@ +function **ajax_forms_test_advanced_commands_data_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'data'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_data_callback($form, FormStateInterface $form_state) { + $selector = '#data_div'; + $response = new AjaxResponse(); + $response->addCommand(new DataCommand($selector, 'testkey', 'testvalue')); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_html_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_html_callback.md new file mode 100644 index 0000000..0aee586 --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_html_callback.md @@ -0,0 +1,12 @@ +function **ajax_forms_test_advanced_commands_html_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'html'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_html_callback($form, FormStateInterface $form_state) { + $response = new AjaxResponse(); + $response->addCommand(new HtmlCommand('#html_div', 'replacement text')); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_insert_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_insert_callback.md new file mode 100644 index 0000000..38b5450 --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_insert_callback.md @@ -0,0 +1,12 @@ +function **ajax_forms_test_advanced_commands_insert_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'insert'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_insert_callback($form, FormStateInterface $form_state) { + $response = new AjaxResponse(); + $response->addCommand(new InsertCommand('#insert_div', 'insert replacement text')); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_invoke_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_invoke_callback.md new file mode 100644 index 0000000..e27dd4c --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_invoke_callback.md @@ -0,0 +1,12 @@ +function **ajax_forms_test_advanced_commands_invoke_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'invoke'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_invoke_callback($form, FormStateInterface $form_state) { + $response = new AjaxResponse(); + $response->addCommand(new InvokeCommand('#invoke_div', 'addClass', array('error'))); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_prepend_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_prepend_callback.md new file mode 100644 index 0000000..d3ed8a3 --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_prepend_callback.md @@ -0,0 +1,12 @@ +function **ajax_forms_test_advanced_commands_prepend_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'prepend'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_prepend_callback($form, FormStateInterface $form_state) { + $response = new AjaxResponse(); + $response->addCommand(new PrependCommand('#prepend_div', "prepended text")); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_remove_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_remove_callback.md new file mode 100644 index 0000000..b9eea7d --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_remove_callback.md @@ -0,0 +1,12 @@ +function **ajax_forms_test_advanced_commands_remove_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'remove'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_remove_callback($form, FormStateInterface $form_state) { + $response = new AjaxResponse(); + $response->addCommand(new RemoveCommand('#remove_text')); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_restripe_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_restripe_callback.md new file mode 100644 index 0000000..a753eb1 --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_restripe_callback.md @@ -0,0 +1,12 @@ +function **ajax_forms_test_advanced_commands_restripe_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'restripe'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_restripe_callback($form, FormStateInterface $form_state) { + $response = new AjaxResponse(); + $response->addCommand(new RestripeCommand('#restripe_table')); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_settings_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_settings_callback.md new file mode 100644 index 0000000..0529a7d --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_advanced_commands_settings_callback.md @@ -0,0 +1,13 @@ +function **ajax_forms_test_advanced_commands_settings_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects 'settings'. + +**Code:** +```php +function ajax_forms_test_advanced_commands_settings_callback($form, FormStateInterface $form_state) { + $setting['ajax_forms_test']['foo'] = 42; + $response = new AjaxResponse(); + $response->addCommand(new SettingsCommand($setting)); + return $response; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_lazy_load_form_ajax.md b/docs/functions/src/8.1.x/ajax_forms_test_lazy_load_form_ajax.md new file mode 100644 index 0000000..bc4c95d --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_lazy_load_form_ajax.md @@ -0,0 +1,20 @@ +function **ajax_forms_test_lazy_load_form_ajax($form, FormStateInterface $form_state)** + +> AJAX form callback: Selects for the ajax_forms_test_lazy_load_form() form. + +**Code:** +```php +function ajax_forms_test_lazy_load_form_ajax($form, FormStateInterface $form_state) { + $build = [ + '#markup' => 'new content', + ]; + + if ($form_state->getValue('add_files')) { + $build['#attached']['library'][] = 'system/admin'; + $build['#attached']['library'][] = 'system/drupal.system'; + $build['#attached']['drupalSettings']['ajax_forms_test_lazy_load_form_submit'] = 'executed'; + } + + return $build; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_validation_form_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_validation_form_callback.md new file mode 100644 index 0000000..1a58f66 --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_validation_form_callback.md @@ -0,0 +1,12 @@ +function **ajax_forms_test_validation_form_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects the 'drivertext' element of the validation form. + +**Code:** +```php +function ajax_forms_test_validation_form_callback($form, FormStateInterface $form_state) { + drupal_set_message("ajax_forms_test_validation_form_callback invoked"); + drupal_set_message(t("Callback: drivertext=%drivertext, spare_required_field=%spare_required_field", array('%drivertext' => $form_state->getValue('drivertext'), '%spare_required_field' => $form_state->getValue('spare_required_field')))); + return ['#markup' => '
ajax_forms_test_validation_form_callback at ' . date('c') . '
']; +} +``` diff --git a/docs/functions/src/8.1.x/ajax_forms_test_validation_number_form_callback.md b/docs/functions/src/8.1.x/ajax_forms_test_validation_number_form_callback.md new file mode 100644 index 0000000..b0cf90b --- /dev/null +++ b/docs/functions/src/8.1.x/ajax_forms_test_validation_number_form_callback.md @@ -0,0 +1,12 @@ +function **ajax_forms_test_validation_number_form_callback($form, FormStateInterface $form_state)** + +> Ajax form callback: Selects the 'drivernumber' element of the validation form. + +**Code:** +```php +function ajax_forms_test_validation_number_form_callback($form, FormStateInterface $form_state) { + drupal_set_message("ajax_forms_test_validation_number_form_callback invoked"); + drupal_set_message(t("Callback: drivernumber=%drivernumber, spare_required_field=%spare_required_field", array('%drivernumber' => $form_state->getValue('drivernumber'), '%spare_required_field' => $form_state->getValue('spare_required_field')))); + return ['#markup' => '
ajax_forms_test_validation_number_form_callback at ' . date('c') . '
']; +} +``` diff --git a/docs/functions/src/8.1.x/archiver_get_archiver.md b/docs/functions/src/8.1.x/archiver_get_archiver.md new file mode 100644 index 0000000..332584c --- /dev/null +++ b/docs/functions/src/8.1.x/archiver_get_archiver.md @@ -0,0 +1,23 @@ +function **archiver_get_archiver($file)** + +> Creates the appropriate archiver for the specified file. + +* **$file**: +        type: _mixed_ +        description: _The full path of the archive file. Note that stream wrapper paths are supported, but not remote ones._ + +* **Return:** +        type: _object|bool_ +        description: _A newly created instance of the archiver class appropriate for the specified file, already bound to that file. If no appropriate archiver class was found, will return FALSE._ + +**Code:** +```php +function archiver_get_archiver($file) { + // Archivers can only work on local paths + $filepath = drupal_realpath($file); + if (!is_file($filepath)) { + throw new Exception(t('Archivers can only operate on local files: %file not supported', array('%file' => $file))); + } + return \Drupal::service('plugin.manager.archiver')->getInstance(array('filepath' => $filepath)); +} +``` diff --git a/docs/functions/src/8.1.x/archiver_get_extensions.md b/docs/functions/src/8.1.x/archiver_get_extensions.md new file mode 100644 index 0000000..65583cd --- /dev/null +++ b/docs/functions/src/8.1.x/archiver_get_extensions.md @@ -0,0 +1,24 @@ +function **archiver_get_extensions()** + +> Returns a string of supported archive extensions. + +* **Return:** +        type: _string_ +        description: _A space-separated string of extensions suitable for use by the file validation system._ + +**Code:** +```php +function archiver_get_extensions() { + $valid_extensions = array(); + foreach (\Drupal::service('plugin.manager.archiver')->getDefinitions() as $archive) { + foreach ($archive['extensions'] as $extension) { + foreach (explode('.', $extension) as $part) { + if (!in_array($part, $valid_extensions)) { + $valid_extensions[] = $part; + } + } + } + } + return implode(' ', $valid_extensions); +} +``` diff --git a/docs/functions/src/8.1.x/authorize_access_allowed.md b/docs/functions/src/8.1.x/authorize_access_allowed.md new file mode 100644 index 0000000..8bc1d2d --- /dev/null +++ b/docs/functions/src/8.1.x/authorize_access_allowed.md @@ -0,0 +1,24 @@ +function **authorize_access_allowed(Request $request)** + +> Determines if the current user is allowed to run authorize.php. + +> The killswitch in settings.php overrides all else, otherwise, the user must have access to the 'administer software updates' permission. + +* **$request:** +        type: _\Symfony\Component\HttpFoundation\Request_ +        description: _The incoming request._ + +* **Return:** +        type: _bool_ +        description: _TRUE if the current user can run authorize.php, and FALSE if not._ + +**Code:** +```php +function authorize_access_allowed(Request $request) { + $account = \Drupal::service('authentication')->authenticate($request); + if ($account) { + \Drupal::currentUser()->setAccount($account); + } + return Settings::get('allow_authorize_operations', TRUE) && \Drupal::currentUser()->hasPermission('administer software updates'); +} +``` \ No newline at end of file diff --git a/docs/functions/src/8.1.x/automated_cron_form_system_cron_settings_alter.md b/docs/functions/src/8.1.x/automated_cron_form_system_cron_settings_alter.md new file mode 100644 index 0000000..f99b788 --- /dev/null +++ b/docs/functions/src/8.1.x/automated_cron_form_system_cron_settings_alter.md @@ -0,0 +1,38 @@ +function **automated_cron_form_system_cron_settings_alter(&$form, &$form_state)** + +> Implements hook_form_FORM_ID_alter() for the system_cron_settings() form. + +**Code:** +```php +function automated_cron_form_system_cron_settings_alter(&$form, &$form_state) { + $automated_cron_settings = \Drupal::config('automated_cron.settings'); + + // Add automated cron settings. + $form['automated_cron'] = [ + '#title' => t('Cron settings'), + '#type' => 'details', + '#open' => TRUE, + ]; + $options = [3600, 10800, 21600, 43200, 86400, 604800]; + $form['automated_cron']['interval'] = [ + '#type' => 'select', + '#title' => t('Run cron every'), + '#description' => t('More information about setting up scheduled tasks can be found by reading the cron tutorial on drupal.org.', ['@url' => 'https://www.drupal.org/cron']), + '#default_value' => $automated_cron_settings->get('interval'), + '#options' => [0 => t('Never')] + array_map([\Drupal::service('date.formatter'), 'formatInterval'], array_combine($options, $options)), + ]; + + $form['actions']['#type'] = 'actions'; + $form['actions']['submit'] = [ + '#type' => 'submit', + '#value' => t('Save configuration'), + '#button_type' => 'primary', + ]; + + // Add submit callback. + $form['#submit'][] = 'automated_cron_settings_submit'; + + // Theme this form as a config form. + $form['#theme'] = 'system_config_form'; +} +``` diff --git a/docs/functions/src/8.1.x/automated_cron_help.md b/docs/functions/src/8.1.x/automated_cron_help.md new file mode 100644 index 0000000..96aff62 --- /dev/null +++ b/docs/functions/src/8.1.x/automated_cron_help.md @@ -0,0 +1,23 @@ +function **automated_cron_help($route_name, RouteMatchInterface $route_match)** + +> Implements hook_help(). + +**Code:** +```php +function automated_cron_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + case 'help.page.automated_cron': + $output = ''; + $output .= '

' . t('About') . '

'; + $output .= '

' . t('The Automated Cron module runs cron operations for your site using normal browser/page requests instead of having to set up a separate cron job. The Automated Cron module checks at the end of each server response when cron operation was last ran and, if it has been too long since last run, it executes the cron tasks after sending a server response. For more information, see the online documentation for the Automated Cron module.', [':automated_cron-documentation' => 'https://www.drupal.org/documentation/modules/automated_cron']) . '

'; + $output .= '

' . t('Uses') . '

'; + $output .= '
'; + $output .= '
' . t('Configuring Automated Cron') . '
'; + $output .= '
' . t('On the Cron page, you can set the frequency (time interval) for running cron jobs.', [':cron-settings' => \Drupal::url('system.cron_settings')]) . '
'; + $output .= '
' . t('Disabling Automated Cron') . '
'; + $output .= '
' . t('To disable automated cron, the recommended method is to uninstall the module, to reduce site overhead. If you only want to disable it temporarily, you can set the frequency to Never on the Cron page, and then change the frequency back when you want to start it up again.') . '
'; + $output .= '
'; + return $output; + } +} +``` diff --git a/docs/functions/src/8.1.x/automated_cron_settings_submit.md b/docs/functions/src/8.1.x/automated_cron_settings_submit.md new file mode 100644 index 0000000..1928a28 --- /dev/null +++ b/docs/functions/src/8.1.x/automated_cron_settings_submit.md @@ -0,0 +1,13 @@ +function **automated_cron_settings_submit(array $form, FormStateInterface $form_state)** + +> Form submission handler for system_cron_settings(). + +**Code:** +```php +function automated_cron_settings_submit(array $form, FormStateInterface $form_state) { + \Drupal::configFactory()->getEditable('automated_cron.settings') + ->set('interval', $form_state->getValue('interval')) + ->save(); + drupal_set_message(t('The configuration options have been saved.')); +} +```