/** * Title callback for add page. * * @param string $eck_entity_bundle * The entity type. * * @return string * The title. */ public function addContentPageTitle($eck_entity_bundle) { $eck_entity_bundle = EckEntityBundle::load($eck_entity_bundle); return t('Add %label content', array('%label' => $eck_entity_bundle->get('name'))); }
/** * Checks for an existing ECK bundle. * * @param string $type * The bundle type. * @param array $element * The form element. * @param FormStateInterface $form_state * The form state. * * @return bool * TRUE if this format already exists, FALSE otherwise. */ public function exists($type, array $element, FormStateInterface $form_state) { return EckEntityBundle::load($type); }
/** * Builds a standard list of entity permissions for a given type. * * @param EckEntityBundle $eck_type * The entity type. * * @return array * An array of permissions. */ public function buildPermssions(EckEntityBundle $eck_type) { $type_id = $eck_type->id(); $type_params = array('%type_name' => $eck_type->label()); return array("create {$type_id} entity" => array('title' => $this->t('%type_name: Create new entity', $type_params)), "edit own {$type_id} entity" => array('title' => $this->t('%type_name: Edit own entity', $type_params)), "edit any {$type_id} entity" => array('title' => $this->t('%type_name: Edit any entity', $type_params)), "delete own {$type_id} entity" => array('title' => $this->t('%type_name: Delete own entity', $type_params)), "delete any {$type_id} entity" => array('title' => $this->t('%type_name: Delete any entity', $type_params)), "view own {$type_id} entity" => array('title' => $this->t('%type_name: View own entity', $type_params)), "view any {$type_id} entity" => array('title' => $this->t('%type_name: View any entity', $type_params))); }