idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
55,700 | private function sortJson ( array & $ array ) { if ( [ ] === $ array || ! ( array_keys ( $ array ) !== range ( 0 , count ( $ array ) - 1 ) ) ) { return false ; } ksort ( $ array ) ; foreach ( $ array as & $ item ) { if ( is_array ( $ item ) ) { $ this -> sortJson ( $ item ) ; } } } | Sorts the json entries |
55,701 | protected function performDbUpdates ( array $ sqlStatements ) { $ connectionPool = GeneralUtility :: makeInstance ( ConnectionPool :: class ) ; $ schemaMigrator = GeneralUtility :: makeInstance ( SchemaMigrator :: class ) ; $ sqlUpdateSuggestions = $ schemaMigrator -> getUpdateSuggestions ( $ sqlStatements ) ; $ hasErr... | Performs updates adjusted function from extension_builder |
55,702 | public function updateDatabase ( ) { $ storageRepository = \ TYPO3 \ CMS \ Core \ Utility \ GeneralUtility :: makeInstance ( 'MASK\\Mask\\Domain\\Repository\\StorageRepository' ) ; $ json = $ storageRepository -> load ( ) ; $ sqlStatements = $ this -> getSqlByConfiguration ( $ json ) ; if ( count ( $ sqlStatements ) > ... | Updates the database if necessary |
55,703 | public function getSqlByConfiguration ( $ json ) { $ sql_content = array ( ) ; $ types = array_keys ( $ json ) ; $ nonIrreTables = array ( "pages" , "tt_content" ) ; $ fieldHelper = \ TYPO3 \ CMS \ Core \ Utility \ GeneralUtility :: makeInstance ( 'MASK\\Mask\\Helper\\FieldHelper' ) ; if ( $ types ) { foreach ( $ types... | returns sql statements of all elements and pages and irre |
55,704 | public function addDatabaseTablesDefinition ( array $ sqlString ) { $ storageRepository = \ TYPO3 \ CMS \ Core \ Utility \ GeneralUtility :: makeInstance ( 'MASK\\Mask\\Domain\\Repository\\StorageRepository' ) ; $ json = $ storageRepository -> load ( ) ; $ sql = $ this -> getSqlByConfiguration ( $ json ) ; $ mergedSqlS... | Returns the SQL of all elements and merges it with already existing sql statements for the signal slot dispatcher |
55,705 | public function render ( ) { $ items = array ( ) ; $ cTypes = $ GLOBALS [ 'TCA' ] [ 'tt_content' ] [ 'columns' ] [ 'CType' ] [ 'config' ] [ 'items' ] ; if ( $ cTypes ) { foreach ( $ cTypes as $ type ) { if ( $ type [ 1 ] !== "--div--" ) { if ( \ TYPO3 \ CMS \ Core \ Utility \ GeneralUtility :: isFirstPartOfStr ( $ type... | Returns an array with all content element cTypes |
55,706 | public function process ( ContentObjectRenderer $ cObj , array $ contentObjectConfiguration , array $ processorConfiguration , array $ processedData ) { $ objectManager = GeneralUtility :: makeInstance ( ObjectManager :: class ) ; $ this -> inlineHelper = $ objectManager -> get ( InlineHelper :: class ) ; $ this -> inl... | Process data of a record to add files and inline elements of mask fields |
55,707 | public function generateAction ( ) { $ this -> sqlCodeGenerator -> updateDatabase ( ) ; $ cacheManager = GeneralUtility :: makeInstance ( CacheManager :: class ) ; $ cacheManager -> flushCachesInGroup ( 'system' ) ; } | Generates all the necessary files |
55,708 | protected function prepareStorage ( & $ storage ) { if ( $ storage [ "tca" ] ) { foreach ( $ storage [ "tca" ] as $ key => $ field ) { if ( is_array ( $ field ) ) { if ( $ field [ "config" ] [ "type" ] == "inline" ) { $ storage [ "tca" ] [ $ key ] [ "inlineFields" ] = $ this -> storageRepository -> loadInlineFields ( $... | Prepares the storage array for fluid view |
55,709 | protected function saveHtml ( $ key , $ html ) { $ path = MaskUtility :: getTemplatePath ( $ this -> extSettings , $ key ) ; if ( file_exists ( $ path ) ) { return false ; } GeneralUtility :: writeFile ( $ path , $ html ) ; return true ; } | Saves Fluid HTML for Contentelements if File not exists |
55,710 | public function checkFieldKey ( ServerRequest $ request , Response $ response ) : Response { $ queryParams = $ request -> getQueryParams ( ) ; $ fieldKey = $ queryParams [ 'key' ] ; $ table = 'tt_content' ; if ( isset ( $ queryParams [ 'table' ] ) ) { $ table = $ queryParams [ 'table' ] ; } $ objectManager = GeneralUti... | Checks if a key for a field is available |
55,711 | public function checkElementKey ( ServerRequest $ request , Response $ response ) : Response { $ elementKey = $ request -> getQueryParams ( ) [ 'key' ] ; $ objectManager = GeneralUtility :: makeInstance ( ObjectManager :: class ) ; $ storageRepository = $ objectManager -> get ( StorageRepository :: class ) ; $ isAvaila... | Checks if a key for an element is available |
55,712 | protected function redirectByAction ( ) { $ params = $ this -> request -> getArguments ( ) ; $ formAction = $ params [ "formAction" ] ; $ arguments = array ( ) ; if ( $ params [ "storage" ] [ "type" ] == "pages" ) { $ arguments [ "layoutIdentifier" ] = $ this -> backendLayoutRepository -> findByIdentifier ( $ params [ ... | Redirects the request to the correct view |
55,713 | protected function checkFolders ( ) : void { foreach ( self :: $ folderPathKeys as $ key ) { $ this -> checkFolder ( $ this -> extSettings [ $ key ] , 'tx_mask.all.error.missingfolder' ) ; } $ this -> checkFolder ( $ this -> extSettings [ 'json' ] , 'tx_mask.all.error.missingjson' ) ; } | Check if folders from extensionmanager - settings are existing |
55,714 | protected function createMissingFolders ( ) : bool { $ success = true ; foreach ( self :: $ folderPathKeys as $ key ) { $ success = $ success && $ this -> createFolder ( $ this -> extSettings [ $ key ] ) ; } $ success = $ success && $ this -> createFile ( $ this -> extSettings [ 'json' ] ) ; return $ success ; } | Creates missing folders that are needed for the use of mask |
55,715 | public function createMissingFoldersAction ( ) : void { if ( $ this -> createMissingFolders ( ) ) { $ this -> addFlashMessage ( LocalizationUtility :: translate ( 'tx_mask.all.createdmissingfolders' , 'mask' ) ) ; } $ this -> redirect ( 'list' ) ; } | action creates missing folders |
55,716 | public function render ( ) { $ element = $ this -> arguments [ 'element' ] ; if ( $ this -> doEdit && $ this -> getBackendUser ( ) -> recordEditAccessInternals ( 'tt_content' , $ element ) ) { $ urlParameters = [ 'edit' => [ 'tt_content' => [ $ element [ 'uid' ] => 'edit' ] ] , 'returnUrl' => GeneralUtility :: getIndpE... | returning a EditLink - Tag for TYPO3 Backend |
55,717 | protected function legacyVersion ( $ version ) { $ legacy = file_get_contents ( __DIR__ . '/../resources/legacy.json' ) ; $ legacy = json_decode ( $ legacy , true ) ; return $ legacy [ $ version ] ; } | Get the ChromeDriver version for a legacy version of Chrome . |
55,718 | protected function download ( $ version , $ slug ) { $ archive = $ this -> directory . 'chromedriver.zip' ; $ url = sprintf ( static :: $ downloadUrl , $ version , $ slug ) ; file_put_contents ( $ archive , fopen ( $ url , 'r' ) ) ; return $ archive ; } | Download the ChromeDriver archive . |
55,719 | public static function generateKey ( ) { do { $ salt = sha1 ( time ( ) . mt_rand ( ) ) ; $ newKey = substr ( $ salt , 0 , 40 ) ; } while ( self :: keyExists ( $ newKey ) ) ; return $ newKey ; } | A sure method to generate a unique API key |
55,720 | private static function keyExists ( $ key ) { $ apiKeyCount = self :: where ( 'key' , '=' , $ key ) -> limit ( 1 ) -> count ( ) ; if ( $ apiKeyCount > 0 ) return true ; return false ; } | Checks whether a key exists in the database or not |
55,721 | public function renderToolbar ( $ event ) { Yii :: info ( 'LUYA CMS Toolbar rendering start' , __METHOD__ ) ; $ props = [ ] ; foreach ( Yii :: $ app -> menu -> current -> model -> properties as $ prop ) { $ o = $ prop -> getObject ( ) ; $ props [ ] = [ 'label' => $ o -> label ( ) , 'value' => $ o -> getValue ( ) ] ; } ... | Render the LUYA Toolbar . |
55,722 | public function actionPreview ( $ blockId ) { $ blockItem = Block :: findOne ( $ blockId ) ; if ( ! $ blockItem ) { throw new NotFoundHttpException ( ) ; } $ blockObject = $ blockItem -> getObject ( 'preview' , 'admin-preview' ) ; return $ blockObject -> renderAdminPreview ( ) ; } | Generate the the block preview . |
55,723 | public function actionDeepPageCopyAsTemplate ( ) { $ navId = ( int ) Yii :: $ app -> request -> getBodyParam ( 'navId' ) ; if ( empty ( $ navId ) ) { throw new InvalidCallException ( "navId can not be empty." ) ; } $ nav = Nav :: findOne ( $ navId ) ; if ( ! $ nav ) { throw new InvalidCallException ( "Unable to find th... | Create a page template from a existing page . |
55,724 | public function actionCreatePage ( ) { $ this -> menuFlush ( ) ; $ model = new Nav ( ) ; $ fromDraft = $ this -> postArg ( 'use_draft' ) ; $ parentNavId = $ this -> postArg ( 'parent_nav_id' ) ; $ navContainerId = $ this -> postArg ( 'nav_container_id' ) ; if ( ! empty ( $ parentNavId ) ) { $ navContainerId = Nav :: fi... | Create a new nav entry for the type page ( nav_id will be created . |
55,725 | public function actionCreateFromPage ( ) { $ this -> menuFlush ( ) ; $ model = new Nav ( ) ; $ response = $ model -> createItemLanguageCopy ( $ this -> postArg ( 'id' ) , $ this -> postArg ( 'toLangId' ) , $ this -> postArg ( 'title' ) , $ this -> postArg ( 'alias' ) ) ; if ( is_array ( $ response ) ) { return $ this -... | Create a new page from another existing Page . |
55,726 | private function buildList ( QueryIteratorFilter $ iterator , $ i = 1 ) { if ( $ this -> maxDepth !== null && $ i >= ( $ this -> maxDepth + 1 ) ) { return "" ; } $ listOptions = $ this -> listOptions ; if ( ! isset ( $ listOptions [ 'class' ] ) ) { $ listOptions [ 'class' ] = "" ; } $ listOptions [ 'class' ] .= " " . $... | Builds the list for the given Iterator and recursively calls itself to also generate the menu for all children |
55,727 | protected function handleLayoutFile ( & $ layoutFiles , $ path ) { $ aliased = Yii :: getAlias ( $ path , false ) ; $ filePath = $ aliased ? $ aliased : $ path ; if ( is_dir ( $ filePath ) ) { foreach ( $ this -> getFilesFromFolder ( $ filePath ) as $ file ) { $ handler = $ this -> importLayoutFile ( $ file , $ path ) ... | Assigne saved files into the layoutFiles array defintion . |
55,728 | protected function getFilesFromFolder ( $ folderPath ) { return FileHelper :: findFiles ( $ folderPath , [ 'recursive' => false , 'caseSensitive' => false , 'only' => [ '*.php' ] , 'filter' => function ( $ path ) { return in_array ( substr ( basename ( $ path ) , 0 , 1 ) , $ this -> ignorePrefix ) ? false : null ; } ] ... | Get files from a given folder . |
55,729 | public function comparePlaceholders ( $ array1 , $ array2 ) { if ( ! array_key_exists ( 'placeholders' , $ array1 ) || ! array_key_exists ( 'placeholders' , $ array2 ) ) { return false ; } $ a1 = $ array1 [ 'placeholders' ] ; $ a2 = $ array2 [ 'placeholders' ] ; if ( count ( $ a1 ) !== count ( $ a2 ) ) { return false ;... | Compare two arrays with each in order to determined whether they have differences or not . |
55,730 | public static function fromArray ( array $ configuration ) { $ type = ArrayHelper :: getValue ( $ configuration , 'type' ) ; $ value = ArrayHelper :: getValue ( $ configuration , 'value' ) ; $ target = ArrayHelper :: getValue ( $ configuration , 'target' ) ; if ( empty ( $ type ) ) { return false ; } return ( new self ... | Generate a link converter object from an array . |
55,731 | public function getFileLink ( $ fileId , $ target ) { $ file = Yii :: $ app -> storage -> getFile ( $ fileId ) ; if ( $ file ) { $ file -> setTarget ( $ target ) ; } return $ file ; } | Get a File Link Object . |
55,732 | public function getPageLink ( $ navId , $ target , $ lang = null ) { $ linkQuery = Yii :: $ app -> menu -> find ( ) ; $ linkQuery -> where ( [ 'nav_id' => $ navId ] ) ; $ linkQuery -> with ( [ 'hidden' ] ) ; if ( $ lang ) { $ linkQuery -> lang ( $ lang ) ; } $ link = $ linkQuery -> one ( ) ; if ( $ link ) { $ link -> s... | Get CMS Page Link Object . |
55,733 | public function getItem ( ) { if ( $ this -> _item === null ) { $ this -> _item = Yii :: $ app -> menu -> find ( ) -> where ( [ 'id' => $ this -> childOf ] ) -> with ( 'hidden' ) -> one ( ) ; if ( ! $ this -> _item ) { throw new Exception ( "Unable to find item with id " . $ this -> childOf ) ; } } return $ this -> _it... | Returns the evalutead menu item whether from the childOf property or set from the setter method . |
55,734 | public function setItem ( Item $ item ) { $ this -> childOf = $ item -> id ; $ this -> _item = $ item ; return $ this ; } | Setter method for the item property . |
55,735 | public function getAlias ( ) { if ( $ this -> _alias === null ) { throw new Exception ( 'The $alias property can not be null and must be set.' ) ; } return $ this -> item -> alias . '/' . $ this -> _alias ; } | Getter method for the alias . |
55,736 | public function getLink ( ) { return ( $ this -> _link === null ) ? Yii :: $ app -> menu -> buildItemLink ( $ this -> alias , $ this -> getLang ( ) ) : $ this -> _link ; } | Getter method for the menu link . |
55,737 | public function setTitle ( $ title ) { if ( $ this -> _alias === null ) { $ this -> setAlias ( $ title ) ; } $ this -> _title = $ title ; return $ this ; } | Setter method for the menu title . |
55,738 | public function getLang ( ) { if ( $ this -> _lang === null ) { $ this -> _lang = $ this -> item -> lang ; } return $ this -> _lang ; } | Returns the language from the childOf item . |
55,739 | public function toArray ( ) { return [ 'id' => $ this -> getId ( ) , 'nav_id' => $ this -> getNavId ( ) , 'lang' => $ this -> getLang ( ) , 'link' => $ this -> getLink ( ) , 'title' => Yii :: $ app -> menu -> encodeValue ( $ this -> title ) , 'title_tag' => Yii :: $ app -> menu -> encodeValue ( $ this -> title ) , 'ali... | Parse the injected item to an array . |
55,740 | public function hasGroupPermission ( Group $ group ) { $ definitions = ( new Query ( ) ) -> select ( "nav_id" ) -> from ( "cms_nav_permission" ) -> where ( [ 'group_id' => $ group -> id ] ) -> all ( ) ; if ( count ( $ definitions ) == 0 ) { return true ; } foreach ( $ definitions as $ permission ) { if ( $ this -> id =... | See if a given group has perrmission for the current nav model . |
55,741 | public function hasGroupPermissionSelected ( Group $ group ) { $ definition = ( new Query ( ) ) -> select ( "inheritance" ) -> from ( "cms_nav_permission" ) -> where ( [ 'group_id' => $ group -> id , 'nav_id' => $ this -> id ] ) -> one ( ) ; if ( $ definition ) { return true ; } return false ; } | See if the given group has permission to the current nav model . |
55,742 | public function isGroupPermissionInheritNode ( Group $ group ) { $ definition = ( new Query ( ) ) -> select ( "inheritance" ) -> from ( "cms_nav_permission" ) -> where ( [ 'group_id' => $ group -> id , 'nav_id' => $ this -> id ] ) -> one ( ) ; if ( $ definition ) { return ( bool ) $ definition [ 'inheritance' ] ; } ret... | See if a given group has inherited permission to the current nav model . |
55,743 | public function eventBeforeInsert ( ) { $ item = self :: find ( ) -> where ( [ 'nav_container_id' => $ this -> nav_container_id , 'parent_nav_id' => $ this -> parent_nav_id ] ) -> orderBy ( 'sort_index DESC' ) -> limit ( 1 ) -> asArray ( ) -> one ( ) ; if ( ! $ item ) { $ this -> sort_index = 1 ; } else { $ this -> sor... | find the latest sort index cms_nav item for the current nav_container_id and parent_nav_id and set internal index count plus one . |
55,744 | public function reindex ( $ e ) { $ i = 1 ; foreach ( self :: find ( ) -> where ( [ 'nav_container_id' => $ this -> nav_container_id , 'parent_nav_id' => $ this -> parent_nav_id ] ) -> orderBy ( 'sort_index ASC' ) -> asArray ( ) -> all ( ) as $ model ) { Yii :: $ app -> db -> createCommand ( ) -> update ( self :: table... | Rindex the current pages . |
55,745 | public static function moveToContainer ( $ moveNavId , $ toCatId ) { $ move = self :: findOne ( $ moveNavId ) ; $ move -> nav_container_id = $ toCatId ; $ move -> parent_nav_id = 0 ; $ move -> update ( ) ; foreach ( $ move -> getRecursiveChildren ( ) as $ child ) { $ child -> updateAttributes ( [ 'nav_container_id' => ... | Move a nav model to a container . |
55,746 | public static function checkDuplicateAlias ( $ currentNavId , $ parentNavId ) { $ currentNavItems = NavItem :: find ( ) -> where ( [ 'nav_id' => $ currentNavId ] ) -> asArray ( ) -> all ( ) ; foreach ( self :: find ( ) -> where ( [ 'parent_nav_id' => $ parentNavId , 'is_deleted' => false ] ) -> andWhere ( [ '<>' , 'id'... | Check for duplicate alias in same parent_nav_id context of targetNav comparing with currentNav item . Additional this checks for matching language contexts when comparing aliases . |
55,747 | public static function moveToBefore ( $ moveNavId , $ toBeforeNavId ) { $ move = self :: findOne ( $ moveNavId ) ; $ to = self :: findOne ( $ toBeforeNavId ) ; if ( ! $ move || ! $ to ) { return false ; } $ response = self :: checkDuplicateAlias ( $ move -> id , $ to -> parent_nav_id ) ; if ( $ response !== true ) { re... | Move a nav model before another nav model . |
55,748 | public static function moveToChild ( $ moveNavId , $ droppedOnItemId ) { $ move = self :: findOne ( $ moveNavId ) ; $ on = self :: findOne ( $ droppedOnItemId ) ; if ( ! $ move || ! $ on ) { return false ; } $ response = self :: checkDuplicateAlias ( $ move -> id , $ on -> id ) ; if ( $ response !== true ) { return $ r... | Move a nav model to a child . |
55,749 | public function moveUpstairs ( $ withCurrentElement = true ) { $ operator = $ withCurrentElement ? '>=' : '>' ; $ startIndex = $ withCurrentElement ? ( int ) $ this -> sort_index : ( int ) $ this -> sort_index + 1 ; foreach ( self :: find ( ) -> where ( 'sort_index ' . $ operator . ' :index' , [ 'index' => ( int ) $ th... | Raise the sort_index value for all elements where the current sort index is larger or equal . |
55,750 | public function moveDownstairs ( ) { $ startIndex = ( int ) $ this -> sort_index ; foreach ( self :: find ( ) -> where ( 'sort_index >= :index' , [ 'index' => $ startIndex ] ) -> andWhere ( [ 'nav_container_id' => $ this -> nav_container_id , 'parent_nav_id' => $ this -> parent_nav_id ] ) -> orderBy ( 'sort_index ASC' ... | Reduces the sort_index value for all elements where the current sort index is larger or equal . |
55,751 | public function createPageItem ( $ navId , $ langId , $ title , $ alias , $ layoutId , $ description ) { $ _errors = [ ] ; $ navItem = new NavItem ( ) ; $ navItem -> parent_nav_id = self :: findOne ( $ navId ) -> parent_nav_id ; $ navItemPage = new NavItemPage ( ) ; $ navItem -> attributes = [ 'nav_id' => $ navId , 'la... | Create a nav item for a given NavId . |
55,752 | public function createModule ( $ parentNavId , $ navContainerId , $ langId , $ title , $ alias , $ moduleName , $ description ) { $ _errors = [ ] ; $ nav = $ this ; $ navItem = new NavItem ( ) ; $ navItem -> parent_nav_id = $ parentNavId ; $ navItemModule = new NavItemModule ( ) ; $ nav -> attributes = [ 'parent_nav_id... | Create a new Module Page . |
55,753 | public function createModuleItem ( $ navId , $ langId , $ title , $ alias , $ moduleName , $ description ) { $ _errors = [ ] ; $ navItem = new NavItem ( ) ; $ navItem -> parent_nav_id = self :: findOne ( $ navId ) -> parent_nav_id ; $ navItemModule = new NavItemModule ( ) ; $ navItem -> attributes = [ 'nav_id' => $ nav... | Create a module for a given Nav Model . |
55,754 | public function createRedirectItem ( $ navId , $ langId , $ title , $ alias , $ redirectType , $ redirectTypeValue , $ description , $ redirectTypeTarget ) { $ _errors = [ ] ; $ navItem = new NavItem ( ) ; $ navItem -> parent_nav_id = self :: findOne ( $ navId ) -> parent_nav_id ; $ navItemRedirect = new NavItemRedirec... | Create a redirecte for a given Nav Model . |
55,755 | public function getContextConfigValue ( $ varName , $ defaultValue = null ) { if ( $ this -> type == InternalBaseBlock :: INJECTOR_VAR ) { return $ this -> context -> getVarValue ( $ varName , $ defaultValue ) ; } if ( $ this -> type == InternalBaseBlock :: INJECTOR_CFG ) { return $ this -> context -> getCfgValue ( $ v... | Returns the value of the variable which is defined for this injector object based on it given type . |
55,756 | private function generateHtml ( $ href , $ isActive , $ lang ) { if ( ! isset ( static :: $ registerLinkTags [ $ href ] ) ) { $ this -> view -> registerLinkTag ( [ 'rel' => 'alternate' , 'hreflang' => $ lang [ 'short_code' ] , 'href' => Yii :: $ app -> urlManager -> hostInfo . $ href ] ) ; static :: $ registerLinkTags ... | Generate the item element . |
55,757 | private static function getDataArray ( ) { if ( self :: $ _dataArray === null ) { $ currentMenuItem = Yii :: $ app -> menu -> current ; $ array = [ ] ; foreach ( Yii :: $ app -> adminLanguage -> getLanguages ( ) as $ lang ) { $ array [ ] = [ 'lang' => $ lang , 'item' => Yii :: $ app -> menu -> find ( ) -> where ( [ 'na... | Add Singleton Container . |
55,758 | public function getNavs ( ) { return $ this -> hasMany ( Nav :: className ( ) , [ 'nav_container_id' => 'id' ] ) -> where ( [ 'is_deleted' => false , 'is_draft' => false ] ) -> orderBy ( [ 'sort_index' => SORT_ASC ] ) ; } | Relation returns all cms_nav rows belongs to this container sort by index without deleted or draf items . |
55,759 | public function getOption ( $ key ) { return ( isset ( $ this -> _options [ $ key ] ) ) ? $ this -> _options [ $ key ] : false ; } | Get a specific option value for a defined eky . |
55,760 | public function parse ( $ value , $ sub ) { $ page = Nav :: findOne ( $ value ) ; if ( $ page ) { if ( $ page -> activeLanguageItem -> nav_item_type !== NavItem :: TYPE_PAGE ) { return null ; } if ( empty ( $ sub ) ) { return $ page -> activeLanguageItem -> getContent ( ) ; } else { return $ page -> activeLanguageItem ... | Get the content of Nav for the current active language with cmslayout or placeholder . |
55,761 | protected function has ( $ key ) { if ( ! is_array ( $ key ) ) { return ( array_key_exists ( $ key , $ this -> item ) ) ; } foreach ( $ key as $ value ) { if ( ! array_key_exists ( $ value , $ this -> item ) ) { return false ; } } return true ; } | Has the config element an element or not . |
55,762 | private function getModuleProposal ( ) { $ moduleNames = [ ] ; foreach ( Yii :: $ app -> getApplicationModules ( ) as $ id => $ obj ) { $ moduleNames [ $ id ] = $ id ; } return $ moduleNames ; } | Get an array with all modules where you can generate blocks for . |
55,763 | private function varCreator ( $ prefix , $ typeCast ) { $ this -> output ( PHP_EOL . '-> Create new ' . $ prefix , Console :: FG_YELLOW ) ; $ name = $ this -> prompt ( 'Variable Name:' , [ 'required' => true ] ) ; $ label = $ this -> prompt ( 'End-User Label:' , [ 'required' => true ] ) ; $ type = $ this -> select ( 'V... | Create a variable based of user input . |
55,764 | protected function getFileNamespace ( ) { if ( $ this -> type == self :: TYPE_APP ) { return 'app\\blocks' ; } return Yii :: $ app -> getModule ( $ this -> moduleName ) -> getNamespace ( ) . '\\blocks' ; } | Get the file namespace based on its type . |
55,765 | protected function getFileBasePath ( ) { if ( $ this -> type == self :: TYPE_APP ) { return Yii :: $ app -> basePath ; } return Yii :: $ app -> getModule ( $ this -> moduleName ) -> getBasePath ( ) ; } | Get the full base path to the folder of the module |
55,766 | public function generateViewFile ( $ blockClassName ) { sort ( $ this -> viewFileDoc ) ; return $ this -> view -> render ( '@cms/views/commands/block/create_block_view.php' , [ 'blockClassName' => $ blockClassName , 'phpdoc' => $ this -> viewFileDoc , 'luyaText' => $ this -> getGeneratorText ( 'block/create' ) , ] ) ; ... | Generate the view file for the block . |
55,767 | public function actionFind ( $ search = null ) { $ rows = [ ] ; $ query = Block :: find ( ) ; foreach ( StringHelper :: explode ( $ search ) as $ q ) { $ query -> orFilterWhere ( [ 'like' , 'class' , $ q ] ) ; } $ blocks = $ query -> with ( [ 'navItemPageBlockItems' ] ) -> all ( ) ; foreach ( $ blocks as $ block ) { $ ... | Search for a given block by its class or return all . |
55,768 | public function actionMigrate ( $ old , $ replace ) { $ block = Block :: find ( ) -> where ( [ 'like' , 'class' , $ old ] ) -> one ( ) ; if ( ! $ block ) { return $ this -> outputError ( "Unable to find a block for '{$old}'" ) ; } $ this -> outputInfo ( "Found block '{$block->class}' with ID {$block->id} used {$block->... | Search for a given block and replace the class by replace argument . |
55,769 | public function actionCleanup ( ) { $ delete = [ ] ; $ this -> output ( "Blocks to delete:" ) ; foreach ( Block :: find ( ) -> all ( ) as $ block ) { if ( ! $ block -> getFileExists ( ) ) { $ this -> outputInfo ( "{$block->class} (id: {$block->id}) used {$block->usageCount} times." ) ; $ delete [ ] = $ block ; } } if (... | Search for blocks with none existing class files and remove them . |
55,770 | private function getPlaceholders ( $ navItemPageId , $ placeholderVar , $ prevId ) { return ( new Query ( ) ) -> from ( 'cms_nav_item_page_block_item t1' ) -> select ( [ 't1.id' , 't1.block_id' , 't1.json_config_values' , 't1.json_config_cfg_values' , 't1.variation' , 't2.class' ] ) -> innerJoin ( 'cms_block t2' , 't2.... | Get all placeholders as array for a given pageId placeholder and prevId . |
55,771 | public static function copyBlocks ( $ fromPageId , $ toPageId ) { $ pageBlocks = NavItemPageBlockItem :: find ( ) -> where ( [ 'nav_item_page_id' => $ fromPageId ] ) -> asArray ( true ) -> all ( ) ; $ idLink = [ ] ; foreach ( $ pageBlocks as $ block ) { $ blockItem = new NavItemPageBlockItem ( ) ; $ blockItem -> attrib... | Copy blocks from one page to another . |
55,772 | public function getView ( ) { if ( $ this -> _view === null ) { $ this -> _view = Yii :: createObject ( PhpBlockView :: class ) ; } return $ this -> _view ; } | View Object getter . |
55,773 | public function onRegister ( ) { if ( $ this -> isCachingEnabled ( ) ) { $ phpBlockView = $ this -> getView ( ) ; $ blockId = $ this -> getEnvOption ( 'id' ) ; $ cacheKeyAssets = [ 'blockassets' , $ blockId ] ; $ cacheKeyAssetBundles = [ 'blockassetbundles' , $ blockId ] ; $ assets = Yii :: $ app -> cache -> getOrSet (... | Save the registered assets form block to the cache . |
55,774 | public function onRegisterFromCache ( ) { if ( $ this -> isCachingEnabled ( ) ) { $ blockId = $ this -> getEnvOption ( 'id' ) ; $ cacheKeyAssets = [ 'blockassets' , $ blockId ] ; $ cacheKeyAssetBundles = [ 'blockassetbundles' , $ blockId ] ; $ assets = Yii :: $ app -> cache -> get ( $ cacheKeyAssets ) ? : [ ] ; $ asset... | Load the block assets from cache and register to the app view . |
55,775 | public function actionIndex ( $ callback , $ id ) { $ model = NavItemPageBlockItem :: findOne ( $ id ) ; if ( ! $ model ) { throw new Exception ( "Unable to find item id." ) ; } $ block = $ model -> block -> getObject ( $ model -> id , 'callback' ) ; if ( ! $ block ) { throw new Exception ( "Unable to find block object... | Run the callback for a given block . |
55,776 | protected function callbackToMethod ( $ callbackName ) { if ( ! StringHelper :: startsWith ( $ callbackName , 'callback' ) ) { return 'callback' . Inflector :: id2camel ( $ callbackName ) ; } return lcfirst ( Inflector :: id2camel ( $ callbackName ) ) ; } | Ensure the callback method from a given name . |
55,777 | public function actionDataMenu ( ) { return [ 'items' => ArrayHelper :: typeCast ( MenuHelper :: getItems ( ) ) , 'drafts' => ArrayHelper :: typeCast ( MenuHelper :: getDrafts ( ) ) , 'containers' => ArrayHelper :: typeCast ( MenuHelper :: getContainers ( ) ) , 'hiddenCats' => ArrayHelper :: typeCast ( Yii :: $ app -> ... | Returns an array with all data for the admin menu . |
55,778 | public function actionItems ( $ langId , $ containerId ) { $ items = Nav :: find ( ) -> where ( [ 'nav_container_id' => $ containerId , 'is_offline' => false , 'ni.lang_id' => $ langId , 'is_deleted' => false ] ) -> joinWith ( [ 'navItems ni' ] ) -> asArray ( ) -> all ( ) ; $ result = [ ] ; foreach ( $ items as $ item ... | Provides all menu items for a given langId and containerId index by the parent_nav_id . |
55,779 | public function actionDataPermissionTree ( ) { $ data = [ ] ; foreach ( NavContainer :: find ( ) -> with ( 'navs' ) -> all ( ) as $ container ) { $ this -> getItems ( $ container ) ; $ data [ 'containers' ] [ ] = [ 'containerInfo' => $ container , 'items' => isset ( self :: $ _permissionItemData [ $ container -> id ] )... | Returns the full tree with groups pages is_inherit or not does have rights or not as it was to hard to implement this features directly with angular now we just prepare anything withing php and delivers to angular only to display the data . |
55,780 | private function getGroups ( ) { if ( $ this -> _groups === null ) { $ this -> _groups = Group :: find ( ) -> all ( ) ; } return $ this -> _groups ; } | Get all groups as singleton instance . |
55,781 | private function getItems ( NavContainer $ container , $ parentNavId = 0 , $ parentGroup = [ ] , $ index = 1 ) { $ navs = $ container -> getNavs ( ) -> andWhere ( [ 'parent_nav_id' => $ parentNavId ] ) -> all ( ) ; foreach ( $ navs as $ nav ) { $ array = $ nav -> toArray ( ) ; if ( empty ( $ nav -> activeLanguageItem )... | Build a trree with items for a given NavContainer . |
55,782 | public function actionDataPermissionInsert ( ) { $ navId = ( int ) Yii :: $ app -> request -> getBodyParam ( 'navId' ) ; $ groupId = ( int ) Yii :: $ app -> request -> getBodyParam ( 'groupId' ) ; if ( empty ( $ navId ) || empty ( $ groupId ) ) { throw new InvalidArgumentException ( "navId and groupId can not be empty.... | Save a new permission for a given group and nav id . |
55,783 | public function actionDataPermissionInsertInheritance ( ) { $ navId = ( int ) Yii :: $ app -> request -> getBodyParam ( 'navId' ) ; $ groupId = ( int ) Yii :: $ app -> request -> getBodyParam ( 'groupId' ) ; if ( empty ( $ navId ) || empty ( $ groupId ) ) { throw new InvalidArgumentException ( "navId and groupId can no... | Save a new permission inhertiance for a given group and nav id . |
55,784 | public function actionDataPermissionDelete ( ) { $ navId = ( int ) Yii :: $ app -> request -> getBodyParam ( 'navId' ) ; $ groupId = ( int ) Yii :: $ app -> request -> getBodyParam ( 'groupId' ) ; if ( empty ( $ navId ) || empty ( $ groupId ) ) { throw new InvalidArgumentException ( "navId and groupId can not be empty.... | Delete the permission for a given group and nav id . |
55,785 | public function actionDataPermissionDeleteInheritance ( ) { $ navId = ( int ) Yii :: $ app -> request -> getBodyParam ( 'navId' ) ; $ groupId = ( int ) Yii :: $ app -> request -> getBodyParam ( 'groupId' ) ; if ( empty ( $ navId ) || empty ( $ groupId ) ) { throw new InvalidArgumentException ( "navId and groupId can no... | Delete the permission inheritance for a given group and nav id . |
55,786 | public function actionDataPermissionGrantGroup ( ) { $ groupId = ( int ) Yii :: $ app -> request -> getBodyParam ( 'groupId' ) ; if ( empty ( $ groupId ) ) { throw new InvalidArgumentException ( "groupId can not be empty." ) ; } return Yii :: $ app -> db -> createCommand ( ) -> delete ( 'cms_nav_permission' , [ 'group_... | Grant access to a given group . |
55,787 | public static function getItems ( ) { if ( self :: $ items === null ) { $ items = ( new Query ( ) ) -> select ( [ 'cms_nav.id' , 'nav_item_id' => 'cms_nav_item.id' , 'nav_container_id' , 'parent_nav_id' , 'is_hidden' , 'layout_file' , 'is_offline' , 'is_draft' , 'is_home' , 'cms_nav_item.title' , 'publish_from' , 'publ... | Get all nav data entries with corresponding item content |
55,788 | private static function loadInheritanceData ( $ parentNavId = 0 , $ fromInheritNode = false ) { $ items = ( isset ( self :: getNavItems ( ) [ $ parentNavId ] ) ) ? self :: getNavItems ( ) [ $ parentNavId ] : [ ] ; foreach ( $ items as $ item ) { $ internalCheck = false ; foreach ( Yii :: $ app -> adminuser -> identity ... | Find nav_id inheritances |
55,789 | public static function getContainers ( ) { if ( self :: $ containers === null ) { self :: $ containers = ( new Query ( ) ) -> select ( [ 'id' , 'name' , 'alias' ] ) -> from ( 'cms_nav_container' ) -> where ( [ 'is_deleted' => false ] ) -> indexBy ( 'id' ) -> orderBy ( [ 'cms_nav_container.id' => 'ASC' ] ) -> all ( ) ; ... | Get all cms containers |
55,790 | public static function getDrafts ( ) { if ( self :: $ drafts === null ) { self :: $ drafts = ( new Query ( ) ) -> select ( [ 'cms_nav.id' , 'nav_container_id' , 'parent_nav_id' , 'is_hidden' , 'is_offline' , 'is_draft' , 'is_home' , 'cms_nav_item.title' ] ) -> from ( 'cms_nav' ) -> leftJoin ( 'cms_nav_item' , 'cms_nav.... | Get all drafts nav items |
55,791 | public function setBlockVariations ( array $ config ) { $ _variations = [ ] ; foreach ( $ config as $ key => $ content ) { if ( is_numeric ( $ key ) && is_array ( $ content ) ) { $ _variations [ key ( $ content ) ] = array_shift ( $ content ) ; } else { $ _variations [ $ key ] = $ content ; } } $ this -> _blockVariatio... | Set block variations . |
55,792 | public static function getAuthorUserId ( ) { return ( Yii :: $ app instanceof \ luya \ web \ Application ) ? Yii :: $ app -> adminuser -> getId ( ) : self :: $ _authorUserId ; } | Get the user id of the logged in user in web appliation context . |
55,793 | public function add ( $ identifier , $ title ) { $ identifier = Inflector :: slug ( $ identifier ) ; $ this -> _variations [ $ identifier ] = [ 'title' => $ title , 'cfgs' => [ ] , 'vars' => [ ] , 'extras' => [ ] , 'is_default' => false , ] ; $ this -> _tempIdentifier = $ identifier ; return $ this ; } | Register a new flavor . |
55,794 | public function getMenu ( ) { if ( $ this -> _menu === null ) { $ this -> _menu = Yii :: $ app -> get ( 'menu' ) ; } return $ this -> _menu ; } | Getter method to return menu component |
55,795 | public function orderBy ( array $ order ) { $ orderBy = [ 'keys' => [ ] , 'directions' => [ ] ] ; foreach ( $ order as $ key => $ direction ) { $ orderBy [ 'keys' ] [ ] = $ key ; $ orderBy [ 'directions' ] [ ] = $ direction ; } $ this -> _order = $ orderBy ; return $ this ; } | Order the query by one or multiple fields asc or desc . |
55,796 | public function one ( ) { $ data = $ this -> filter ( $ this -> menu [ $ this -> getLang ( ) ] , $ this -> _where , $ this -> _with ) ; if ( count ( $ data ) == 0 ) { return false ; } return static :: createItemObject ( array_values ( $ data ) [ 0 ] , $ this -> getLang ( ) ) ; } | Retrieve only one result for your query even if there are more rows then one it will just pick the first row from the filtered result and return the item object . If the filtering based on the query settings does not return any result the return will be false . |
55,797 | public function all ( ) { return static :: createArrayIterator ( $ this -> filter ( $ this -> menu [ $ this -> getLang ( ) ] , $ this -> _where , $ this -> _with ) , $ this -> getLang ( ) , $ this -> _with , $ this -> _preloadModels ) ; } | Retrieve all found rows based on the filtering options and returns the the QueryIterator object which is represents an array . |
55,798 | public function count ( ) { return count ( $ this -> filter ( $ this -> menu [ $ this -> getLang ( ) ] , $ this -> _where , $ this -> _with ) ) ; } | Returns the count for the provided filter options . |
55,799 | public static function createArrayIterator ( array $ data , $ langContext , $ with , $ preloadModels = false ) { return ( new QueryIteratorFilter ( new QueryIterator ( [ 'data' => $ data , 'lang' => $ langContext , 'with' => $ with , 'preloadModels' => $ preloadModels ] ) ) ) ; } | Static method to create an iterator object based on the provided array data with optional language context . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.