Results

27.06.2020
domain_entity 8.x-1.0-beta1 :: modules/domain_menu_access/domain_menu_access.module
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
 * Implements hook_form_BASE_FORM_ID_alter() for \Drupal\menu_link_content\MenuLinkContentForm.
 *
 * Move Domain Access fields to an advanced tab like other node settings.
 */
function domain_menu_access_form_menu_link_content_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  /** @var \Drupal\menu_link_content\Form\MenuLinkContentForm $form_object */
  $form_object = $form_state->getFormObject();
  /** @var \Drupal\menu_link_content\Entity\MenuLinkContent $entity */
  $entity = $form_object->getEntity();
 
  /** @var \Drupal\system\MenuInterface $menu */
  $form['domain'] = [
11.04.2019
domain_menu_access 8.x-1.x-dev :: domain_menu_access.module
26
27
28
29
30
31
32
33
*/
function domain_menu_access_form_menu_link_content_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  /** @var \Drupal\menu_link_content\Form\MenuLinkContentForm $form_object */
  $form_object = $form_state->getFormObject();
  /** @var \Drupal\menu_link_content\Entity\MenuLinkContent $entity */
  $entity = $form_object->getEntity();
 
  $config = \Drupal::config('domain_menu_access.settings')->get('menu_enabled');
23.09.2020
entity_hierarchy 8.x-2.24 :: modules/entity_hierarchy_microsite/src/Form/MicrositeMenuItemForm.php
41
42
43
44
45
46
47
48
/**
 * Constructs a MenuLinkContentForm object.
 *
 * @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository
 *   The entity repository.
 * @param \Drupal\Core\Menu\MenuParentFormSelectorInterface $menu_parent_selector
 *   The menu parent form selector service.
 * @param \Drupal\Core\Path\PathValidatorInterface $path_validator
23.09.2020
entity_hierarchy 8.x-2.24 :: modules/entity_hierarchy_microsite/entity_hierarchy_microsite.links.menu.yml
8
9
10
11
entity_hierarchy_microsite:
  class: \Drupal\entity_hierarchy_microsite\Plugin\Menu\MicrositeMenuItem
  form_class: \Drupal\entity_hierarchy_microsite\Form\MenuLinkContentForm
  deriver: \Drupal\entity_hierarchy_microsite\Plugin\Deriver\MicrositeMenuItemDeriver
12.10.2020
group_content_menu 8.x-1.0-rc3 :: src/Form/MenuLinkItemForm.php
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use Drupal\Core\Form\FormStateInterface;
use Drupal\menu_link_content\Form\MenuLinkContentForm;
 
/**
 * Form wrapper for MenuLinkContentForm.
 *
 * @ingroup group_content_menu
 */
final class MenuLinkItemForm extends MenuLinkContentForm {
 
  /**
   * {@inheritdoc}
   */
  public function save(array $form, FormStateInterface $form_state) {
    parent::save($form, $form_state);
05.04.2019
groupmenu 8.x-1.0-beta2 :: groupmenu.module
15
16
17
18
19
20
21
22
23
use Drupal\group\Entity\GroupRelationship;
use Drupal\group\Entity\GroupRelationshipType;
use Drupal\menu_link_content\Form\MenuLinkContentForm;
use Drupal\menu_ui\Form\MenuLinkEditForm;
use Drupal\system\MenuInterface;
 
/**
 * Implements hook_entity_create_access().
 *
83
84
85
86
87
88
89
// Filter menu options to group menus.
if ($form_object instanceof MenuLinkEditForm || $form_object instanceof MenuLinkContentForm) {
  $account = \Drupal::currentUser();
  if (!$account->hasPermission('administer menu')) {
    groupmenu_filter_parent_options($form['menu_parent']['#options']);
  }
}
15.10.2020
improvements 2.x-dev :: modules/improvements_menu/src/ImprovementsMenuTrustedCallbacks.php
12
13
14
15
16
17
18
19
20
public static function trustedCallbacks(): array {
  return [
    'menuLinkContentFormPreRender',
  ];
}
 
/**
 * Pre render callback for menu_link_content_form form.
 *
21
22
23
24
25
26
27
28
   * @see improvements_form_menu_link_content_form_alter()
   */
  public static function menuLinkContentFormPreRender(array $form): array {
    $form['description']['#weight'] = -1.1;
    return $form;
  }
 
}
15.10.2020
improvements 2.x-dev :: modules/improvements_menu/improvements_menu.module
9
10
11
12
13
14
15
16
17
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Menu\MenuLinkInterface;
use Drupal\menu_link_content\Form\MenuLinkContentForm;
use Drupal\menu_link_content\MenuLinkContentInterface;
use Drupal\menu_ui\Form\MenuLinkEditForm;
use Drupal\system\Entity\Menu;
use Drupal\system\Plugin\Block\SystemMenuBlock;
 
require_once __DIR__ . '/improvements_menu.link_advanced_settings.inc';
37
38
39
40
41
42
43
44
45
46
47
48
* Implements hook_form_FORM_ID_alter(): menu_link_content_form.
 *
 * @see \Drupal\menu_link_content\Form\MenuLinkContentForm::form()
 */
function improvements_menu_form_menu_link_content_form_alter(array &$form, FormStateInterface $form_state): void {
  $menu_link_form_object = $form_state->getFormObject(); /** @var MenuLinkContentForm $menu_link_form_object */
  $menu_link = $menu_link_form_object->getEntity(); /** @var MenuLinkContentInterface $menu_link */
 
  // Add autofocus to menu link title
  if (isset($form['title']['widget'][0]['value'])) {
    $form['title']['widget'][0]['value']['#attributes']['autofocus'] = 'autofocus';
  }
60
61
62
63
64
65
66
67
68
  $form['#entity_builders'][] = 'improvements_menu_link_content_entity_builder';
  $form['actions']['submit']['#submit'][] = 'improvements_menu_link_form_submit';
  $form['#pre_render'][] = '\Drupal\improvements_menu\ImprovementsMenuTrustedCallbacks::menuLinkContentFormPreRender';
 
  improvements_menu_link_advanced_settings_form_alter($form, $form_state);
}
 
/**
 * Implements hook_form_FORM_ID_alter(): menu_link_edit.
15.10.2020
improvements 2.x-dev :: modules/improvements_menu/improvements_menu.link_advanced_settings.inc
6
7
8
9
10
11
12
13
use Drupal\Core\Url;
use Drupal\druhels\DrupalHelper;
use Drupal\menu_link_content\Form\MenuLinkContentForm;
use Drupal\menu_link_content\MenuLinkContentInterface;
use Drupal\menu_ui\Form\MenuLinkEditForm;
use Drupal\menu_ui\MenuForm;
use Drupal\system\Entity\Menu;
use Drupal\system\MenuInterface;
19
20
21
22
23
24
25
26
27
$form_object = $form_state->getFormObject();
 
if ($form_object instanceof MenuLinkContentForm) {
  $menu_link = $form_object->getEntity(); /** @var MenuLinkContentInterface $menu_link */
}
elseif ($form_object instanceof MenuLinkEditForm) {
  $menu_link = $form_state->getBuildInfo()['args'][0]; /** @var MenuLinkInterface $menu_link */
}
else {
20.04.2022
menu_disallow_external_links 1.0.0-rc1 :: menu_disallow_external_links.module
58
59
60
61
62
63
64
65
66
function menu_disallow_external_links_form_menu_link_content_menu_link_content_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  // Get menu link object.
  /** @var Drupal\menu_link_content\Form\MenuLinkContentForm */
  $form_object = $form_state->getFormObject();
  /** @var Drupal\menu_link_content\Entity\MenuLinkContent */
  $menu_link = $form_object->getEntity();
 
  // Determine whether the link belongs to a menu that disallows external links.
  $menu_name = $menu_link->getMenuName();
12.03.2018
menu_link_highlight 8.x-1.x-dev :: menu_link_highlight.module
29
30
31
32
33
34
35
36
37
*/
function menu_link_highlight_menu_link_content_form_submit($form, FormStateInterface $form_state) {
  /** @var \Drupal\menu_link_content\Form\MenuLinkContentForm $form_object */
  $form_object = $form_state->getFormObject();
  $menu_link = $form_object->getEntity();
 
  if (!$menu_link->link) {
    return;
  }
17.05.2022
menu_lock 1.0.0-rc1 :: menu_lock.module
23
24
25
26
27
28
29
30
31
// Retrieve current user account + menu link object.
$account = \Drupal::currentUser()->getAccount();
/** @var Drupal\menu_link_content\Form\MenuLinkContentForm */
$form_object = $form_state->getFormObject();
/** @var Drupal\menu_link_content\Entity\MenuLinkContent */
$menu_link = $form_object->getEntity();
 
// Limit options in 'Parent link' field.
if (!empty($form['menu_parent']['#options']) && !$account->hasPermission('move menu links across menus')) {
28.03.2020
menu_per_role 8.x-1.x-dev :: menu_per_role.module
87
88
89
90
91
92
93
94
95
$is_content = FALSE;
if ($hide_on_content_mode != MenuPerRoleAdminSettings::MODE_DISPLAY_ON_CONTENT_ALWAYS) {
  /** @var \Drupal\menu_link_content\Form\MenuLinkContentForm $form_obj */
  $form_obj = $form_state->getFormObject();
  /** @var \Drupal\menu_link_content\MenuLinkContentInterface $menu_link */
  $menu_link = $form_obj->getEntity();
  if (!$menu_link->isNew()) {
    $link_url = $menu_link->getUrlObject();
    if ($link_url->isRouted()) {
18.05.2022
menu_perms_per_menu 1.0.0-rc4 :: menu_perms_per_menu.module
17
18
19
20
21
22
23
24
25
// Retrieve current user account + menu link object.
$account = \Drupal::currentUser()->getAccount();
/** @var Drupal\menu_link_content\Form\MenuLinkContentForm */
$form_object = $form_state->getFormObject();
/** @var Drupal\menu_link_content\Entity\MenuLinkContent */
$menu_link = $form_object->getEntity();
 
// Restrict access to 'Link' field.
if ($form['link'] && !$account->hasPermission('edit link of menu links in ' . $menu_link->getMenuName() . ' menu')) {
01.01.2019
micro_menu 8.x-1.0-alpha4 :: micro_menu.module
11
12
13
14
15
16
17
18
19
use Drupal\menu_ui\Form\MenuLinkEditForm;
use Drupal\menu_ui\MenuForm;
use Drupal\menu_link_content\Form\MenuLinkContentForm;
use Drupal\micro_site\Entity\SiteInterface;
use Drupal\system\MenuInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\system\Entity\Menu;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessResult;
169
170
171
172
173
174
175
176
177
$form_object = $form_state->getFormObject();
if ($form_object instanceof MenuLinkEditForm
  || $form_object instanceof MenuLinkContentForm) {
  // We check if we are in a site entity context, and so get the site
  // parameter into the route.
  $site = \Drupal::routeMatch()->getParameter('site');
  $menu = \Drupal::routeMatch()->getParameter('menu');
 
  if ($site instanceof SiteInterface && $menu instanceof MenuInterface) {
15.10.2020
responsive_menu 4.4.1 :: responsive_menu.module
277
278
279
280
281
282
283
284
* Implements hook_form_FORM_ID_alter() for menu_link_content_form().
 *
 * @see \Drupal\menu_link_content\Form\MenuLinkContentForm
 */
function responsive_menu_form_menu_link_content_form_alter(&$form, FormStateInterface $form_state) {
  $menu_link = $form_state->getFormObject()->getEntity();
  $menu_link_options = $menu_link->link->first()->options ?: [];
  $flyleft = isset($menu_link_options['attributes']['flyleft']);
27.10.2021
stm 8.x-1.0 :: src/Form/SyncToMenuForm.php
193
194
195
196
197
198
199
200
201
    'taxonomy_term_id' => $tid,
  ),
  'form_class' => '\Drupal\menu_link_content\Form\MenuLinkContentForm',
  'enabled' => 1,
  'provider' => 'menu_link_content',
  //'parent' => $menu_parent_id,
  'link' => array('uri' => $uri, 'title' => 'stm-' . $vid),
  //'url' => $uri,
);
27.01.2025
taxonomy_menu_sync 1.0.4 :: taxonomy_menu_sync.module
10
11
12
13
14
15
16
17
18
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
use Drupal\menu_link_content\Form\MenuLinkContentForm;
use Drupal\menu_link_content\Plugin\Menu\MenuLinkContent;
use Drupal\menu_ui\MenuForm;
 
/**
 * Implements hook_help().
 */
80
81
82
83
84
85
86
87
88
89
if (str_contains($form_id, 'menu_link_content_')) {
  /** @var \Drupal\menu_link_content\Form\MenuLinkContentForm $form_object */
  $form_object = $form_state->getFormObject();
  if (!$form_object instanceof MenuLinkContentForm || taxonomy_menu_sync_user_restrict()) {
    return;
  }
 
  /** @var \Drupal\menu_link_content\MenuLinkContentInterface $menu_entity */
  $menu_entity = $form_object->getEntity();
  $menu_content_id = $menu_entity->id();

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc