Drupal 8  8.0.2
MenuForm Class Reference
Inheritance diagram for MenuForm:

Public Member Functions

 __construct (QueryFactory $entity_query_factory, MenuLinkManagerInterface $menu_link_manager, MenuLinkTreeInterface $menu_tree, LinkGeneratorInterface $link_generator)
 
 form (array $form, FormStateInterface $form_state)
 
 menuNameExists ($value)
 
 save (array $form, FormStateInterface $form_state)
 
- Public Member Functions inherited from EntityForm
 setOperation ($operation)
 
 getBaseFormId ()
 
 getFormId ()
 
 buildForm (array $form, FormStateInterface $form_state)
 
 form (array $form, FormStateInterface $form_state)
 
 processForm ($element, FormStateInterface $form_state, $form)
 
 afterBuild (array $element, FormStateInterface $form_state)
 
 submitForm (array &$form, FormStateInterface $form_state)
 
 save (array $form, FormStateInterface $form_state)
 
 buildEntity (array $form, FormStateInterface $form_state)
 
 getEntity ()
 
 setEntity (EntityInterface $entity)
 
 getEntityFromRouteMatch (RouteMatchInterface $route_match, $entity_type_id)
 
 getOperation ()
 
 setModuleHandler (ModuleHandlerInterface $module_handler)
 
 setEntityManager (EntityManagerInterface $entity_manager)
 
 setEntityTypeManager (EntityTypeManagerInterface $entity_type_manager)
 
- Public Member Functions inherited from EntityFormInterface
 setStringTranslation (TranslationInterface $string_translation)
 
- Public Member Functions inherited from FormInterface
 validateForm (array &$form, FormStateInterface $form_state)
 

Static Public Member Functions

static create (ContainerInterface $container)
 

Protected Member Functions

 buildOverviewForm (array &$form, FormStateInterface $form_state)
 
 submitOverviewForm (array $complete_form, FormStateInterface $form_state)
 
- Protected Member Functions inherited from EntityForm
 init (FormStateInterface $form_state)
 
 actionsElement (array $form, FormStateInterface $form_state)
 
 actions (array $form, FormStateInterface $form_state)
 
 copyFormValuesToEntity (EntityInterface $entity, array $form, FormStateInterface $form_state)
 
 prepareEntity ()
 
 prepareInvokeAll ($hook, FormStateInterface $form_state)
 

Protected Attributes

 $entityQueryFactory
 
 $menuLinkManager
 
 $menuTree
 
 $linkGenerator
 
 $overviewTreeForm = array('#tree' => TRUE)
 
- Protected Attributes inherited from EntityForm
 $operation
 
 $moduleHandler
 
 $entityManager
 
 $entityTypeManager
 
 $entity
 

Detailed Description

Base form for menu edit forms.

Constructor & Destructor Documentation

__construct ( QueryFactory  $entity_query_factory,
MenuLinkManagerInterface  $menu_link_manager,
MenuLinkTreeInterface  $menu_tree,
LinkGeneratorInterface  $link_generator 
)

Constructs a MenuForm object.

Parameters
\Drupal\Core\Entity\Query\QueryFactory$entity_query_factoryThe factory for entity queries.
\Drupal\Core\Menu\MenuLinkManagerInterface$menu_link_managerThe menu link manager.
\Drupal\Core\Menu\MenuLinkTreeInterface$menu_treeThe menu tree service.
\Drupal\Core\Utility\LinkGeneratorInterface$link_generatorThe link generator.

References Drupal\linkGenerator(), and Drupal\menuTree().

Here is the call graph for this function:

Member Function Documentation

buildOverviewForm ( array &  $form,
FormStateInterface  $form_state 
)
protected

Form constructor to edit an entire menu tree at once.

Shows for one menu the menu links accessible to the current user and relevant operations.

This form constructor can be integrated as a section into another form. It relies on the following keys in $form_state:

  • menu: A menu entity.
  • menu_overview_form_parents: An array containing the parent keys to this form. Forms integrating this section should call menu_overview_form_submit() from their form submit handler.

References Element\children(), FormStateInterface\has(), Drupal\menuTree(), FormStateInterface\set(), t(), and Drupal\url().

Referenced by MenuForm\form().

Here is the call graph for this function:

Here is the caller graph for this function:

static create ( ContainerInterface  $container)
static

{}

form ( array  $form,
FormStateInterface  $form_state 
)

{}

References MenuForm\buildOverviewForm(), FormStateInterface\set(), LanguageInterface\STATE_ALL, and t().

Here is the call graph for this function:

menuNameExists (   $value)

Returns whether a menu name already exists.

Parameters
string$valueThe name of the menu.
Returns
bool Returns TRUE if the menu already exists, FALSE otherwise.
save ( array  $form,
FormStateInterface  $form_state 
)

{Form submission handler for the 'save' action.Normally this method should be overridden to provide specific messages to the user and redirect the form after the entity has been saved.

Parameters
array$formAn associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
Returns
int Either SAVED_NEW or SAVED_UPDATED, depending on the operation performed.
}

Implements EntityFormInterface.

References Drupal\logger(), FormStateInterface\setRedirectUrl(), MenuForm\submitOverviewForm(), and t().

Here is the call graph for this function:

submitOverviewForm ( array  $complete_form,
FormStateInterface  $form_state 
)
protected

Submit handler for the menu overview form.

This function takes great care in saving parent items first, then items underneath them. Saving items in the incorrect order can break the tree.

References Element\children(), FormStateInterface\get(), FormStateInterface\getUserInput(), and NestedArray\getValue().

Referenced by MenuForm\save().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: