diff --git a/docs/components/README.md b/docs/components/README.md new file mode 100644 index 0000000..b1ead2d --- /dev/null +++ b/docs/components/README.md @@ -0,0 +1,5 @@ +Template for a components. +========================== +### Document structure: + +### Example: diff --git a/docs/functions/README.md b/docs/functions/README.md new file mode 100644 index 0000000..a76b9b8 --- /dev/null +++ b/docs/functions/README.md @@ -0,0 +1,51 @@ +Template for functions. +======================= +### Document structure: +1. Signature +2. Short description +3. Long description(if exists) +4. Arguments description(if exists) +5. Return statement description(if returns something) +6. Code + +### Example: + +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; +} +``` 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('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('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('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('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' => '' . 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 .= '