Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regular Expression Field + Tabbed Edit Node
[Added] New Regular Expression field allowing you to match dynamic URIs that do not exist in your navigation. [Added] Tabbed layout - moving Attributes, Advanced and all custom field layouts into their own tabs.
- Loading branch information
1 parent
b96db9e
commit 0338619
Showing
9 changed files
with
298 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
namespace Craft; | ||
|
||
/** | ||
* The class name is the UTC timestamp in the format of mYYMMDD_HHMMSS_pluginHandle_migrationName | ||
*/ | ||
class m160922_150924_navee_AddRegexField extends BaseMigration { | ||
|
||
/** | ||
* Any migration code in here is wrapped inside of a transaction. | ||
* | ||
* @return bool | ||
*/ | ||
public function safeUp() | ||
{ | ||
// specify columns and AttributeType | ||
$newColumns = array( | ||
'regex' => ColumnType::Varchar, | ||
); | ||
|
||
$this->_addColumnsAfter('navee_nodes', $newColumns, 'target'); | ||
|
||
// return true and let craft know its done | ||
return true; | ||
} | ||
|
||
private function _addColumnsAfter($tableName, $newColumns, $afterColumnHandle) | ||
{ | ||
|
||
// this is a foreach loop, enough said | ||
foreach ($newColumns as $columnName => $columnType) | ||
{ | ||
// check if the column does NOT exist | ||
if (!craft()->db->columnExists($tableName, $columnName)) | ||
{ | ||
$this->addColumnAfter($tableName, $columnName, array( | ||
'column' => $columnType, | ||
'null' => false, | ||
), | ||
$afterColumnHandle | ||
); | ||
|
||
// log that we created the new column | ||
SeomaticPlugin::log("Created the `$columnName` in the `$tableName` table.", LogLevel::Info, true); | ||
|
||
} | ||
|
||
// if the column already exists in the table | ||
else { | ||
|
||
// tell craft that we couldn't create the column as it alredy exists. | ||
SeomaticPlugin::log("Column `$columnName` already exists in the `$tableName` table.", LogLevel::Info, true); | ||
|
||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.