texts: How to change the labels TRUE and FALSE of a boolean field in views exposed filter

texts:
I am using the flag module to toggle a node type 'Task' as Done.
I made a view that lists the tasks, and added a views exposed filter for the flag status, which is a boolean field.
In this way users can filter the view by selecting True or False for the flag status.

However, I want to change the labels 'True' and 'False' to 'Done' and 'Not Done'

I see no setting in the views exposed filter field that allows to change this setting. Is there another way to do this?


texts: How can I hook into an entityform submission?

texts:
I've got entity forms installed, and I'd like to use some db_queries when a particular entity form is submitted, as to make use of the information filled out on that entity form.

Is this possible, and which hook should I use?


texts: update a entity with presave method to avoir a loop

texts:
In the hook_entity_update function
update_candidat_from_contrat_direct(Drupal\Core\Entity\EntityInterface $entity)

I call another function in which :

I create a new node
   $new_entity = \Drupal::entityTypeManager()->getStorage('node')->create([
    'type' => 'candidat',
    'field_nom' => $nom,
  ]);
  $new_entity->save();

I want to attach this $new_entity to the $entity
  $nid = $new_entity->id();
  $candidats_attaches[] = $nid;
  $entity->set('field_candidats', $candidats_attaches);
  $entity->save();

But because of the call to "save" function, this involve a new call to the "hook_entity_update", so another call to this sub-function, so a loop....
I understood that there is the "presave" function to avoid this behaviour, but I did not succeed to use it. Can I have some advices, please?


texts: Continue saving node under some condition

texts:
Is there a drupal function can i use to check some condition, if it return true the node will be saved if not it should be return to the creation form.
Thanks.


texts: Getting error 'Redirects to external URLs are not allowed by default'

texts:
Getting the error after created this .htacces in root folder.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/web
RewriteRule ^(.*)$ /web/

I want to redirect visitors to /web folder. I can login as Admin and enable modules, install themes and create content without any issues.

When a theme is installed, content created and publish it I get a blankpage with:

"Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it."

I have trusted hostsettings configured like this in settings.php

$settings['trusted_host_patterns'] = array(
  '^my-domain\.com$',
  '^my-domain\.com\.web$',
  '^.+\.my-domain\.com$',
  '^.+\.my-domain\.com\.web$',

according to this issue uncomment RewriteBase / didn't work out either

Hope someone has a solution to this.


texts: hook_options_list not getting fired in a custom module

texts:
I need to limit taxonomy term reference field options based on another field.This is needed as there are around 1000 terms available for this 'Select' field but I want to limit these options to a minimum using hook_options_list.

But this hook is not getting called from the custom module, not much detail provided on the drupal help too.

Does this hook require any prerequisite so it can be called.


texts: option to promote to top of list in drupal

texts:
I have a site that shows top music in a list, I have created a content type called "topMusic" and a view that will show all topMusic content types.

this View shows topMusic content in a row, first content created will get on top of the list, anything added after that will show below it.

I want to add a new button or trigger to the content type, that when its "on", this content gets on the top of the list.

Any idea's will be greatly appreciated.


texts: Can't access links in block_view_alter hook

texts:
I have a two-language site with the standard language switcher block. I want to remove the link that points to the current page language (I only want the user to see one link to switch to the language they're not seeing).

I've tried this:

function mymodule_block_view_language_block_alter(&$build, $block) {
  $build['links'] = []; //for now for debugging purposes, remove all links
}

It doesn't work (though it runs the code). The $build array doesn't have a links key, or anything it's supposed to according to the build method in core/modules/language/src/Plugin/Block/LanguageBlock.php. Why might this happen? How can I alter what I'm seeing there?

BTW I also tried the block_build_alter hook. Similar situation.


texts: how to modify print--mail--node--node-type.tpl.php drupal 7x

texts:
I installed the module https://drupal.org/project/print , drupal 7x , but now we need to get control over each variable on the display node. I mean print out some variables content and other NO, also print it in two columns.
well make a table is not a problem. the PROBLEM is how to get the variable content in order to print out?

I have this code, works, but print all the content by default, in an UGLY way.

I will appreciate ...Any ideas or suggestions.... please sent to me a basic example...


texts: Possible to make image styles (thumbnails) public while original images are kept private in D7?

texts:
I love the fact that D7 allows you to choose whether files should be stored in the public or private file system on a per-field basis.

But here's my question: is it possible to have image files that are stored in the private file system, while thumbnails etc. created via image styles are stored in the public file system, so anyone can access them? In other words, I want to protect the original image files, but not their thumbnails.

By default theme_image_style seems to place the generated styles in the same file system (public or private) as the original image, and I don't see any arguments to change that...


texts: A lot of similar questions show up in Google, but I can't find a solution for Drupal 7.


texts:
How can I have 1 menu (site map), hierarchical structure like:

Dept 1

Abc
Def
Ghi

Dept 4

AAA
BBB

ffe
ffg
ffx

CCC

With possibility to delegate editing permission of subtrees to some users?
I.e. : main admin edits the whole menu, admin A edits only submenu in Dept1, admin B edits only submenu BBB in submenu Dept 4 ...

Is there any module which can be used to do that? I know that Organic Groups has possibility of creating menus for every group with feature of editing permission to group members. But I'd rather have 1 big menu for the whole site...


texts: What is the mechanism used to control how Drupal pages are rendered?

texts:
I'm a Java programmer trying to get started with Drupal.  Specifically, I want to be able to create custom pages.  More specifically, I want to understand the nuts and bolts of how this is done (I'm an engineer; it's just my nature)  I have a little PHP experience and I've configured Drupal installations for years.  I'm aware of many of the modules that help make this process easier (such as the Views module), but again--I'm interested in working through the nuts and bolts myself.

I'm not specifically interested in creating new Drupal modules, unless that is the only way to create new pages in Drupal.  My primary interest is in being able to create a custom page.  Let me give a few examples:

I have a db of funny quotes.  I'd like to be able to use Drupal to display a selected quote AND HAVE COMPLETE CONTROL OVER THE PAGE LAYOUT (and again--not using an existing module; I want to understand the inner workings).  Don't ask why I'd want to use Drupal for this, or suggest alternate methods of accomplishing it.  It's a made up example to illustrate what I'm wanting to learn. :-)
This is a less made up example.  I'd like to create a "newsletter" where the site editors can select submitted content and customize layout (all in a custom UI) and then create a page with that content, one suitable for either viewing in a browser or printing.  Sort of a "desktop publishing" concept for Drupal.  Again, don't suggest ways of accomplishing this.  It's an example to illustrate what I'm wanting to learn.

Basically, I like Drupal's permissioning, modularity, and content management but I'd like to learn how to control display (as complete control over display as possible).  The problem is that I don't even know what topics to start learning.  Creating modules?  Themeing?  Something else?  What is the mechanism or system that I need to learn to be able to completely control how Drupal pages are rendered?

Corollary question: does such control (not limited to just a block or region, but including menus, headers, footers, and everything visible on the page) require modifying the Drupal code directly or can it all be done in the theme/module systems?


texts: Tried to create a custom page template for my home page and now get a 404 error

texts:
I'm new to Drupal so I may have done something horribly wrong.

Using Drupal 7.

I tried to create a custom home page by using the Page builder. I created a page template and assigned it to be used as the home page. Then decided against and deleted the template.

Now I get a 404 response when I go to my home page. The rest of the site works and shows all the pages. I tried clearing the cache but no luck.

Andy help or ideas would be greatly appreciated. Thank you


texts: Custom user profile fields, not editable by user

texts:
I've created some custom user profile fields but I don't want to let the user change those fields when he is editing his profile. These fields should only be changed by the site admin.

How can I do that? Thanks


texts: node:menu tokens not working in Pathauto

texts:
I can't get any node:menu-based tokens to work in my Pathauto replacement patterns.  Other tokens, such as [current-user:name] or [node:language], work fine.  But the token I am trying to use, a menu-based token, specifically [node:menu-link:parents:join:/] does not. I've tried a slew of the node:menu-link tokens, such as [node:menu-link:parent:url:path], and they're all being skipped.

When I bulk delete all Content aliases, then bulk update them, I do not get any error messages.  The resulting aliases from my pattern [node:menu-link:parents:join:/]/[node:title] just ends up being the node title.
git status

I've been banging my head against this for days, and in trying to fix it have:

installed Token Tweaks and set the depth to 2
run drush @test ev "token_clear_cache(); incessantly
disabled Menu Firstchild, then when that didn't help...
updated Menu Firstchild to the dev version and applied this patch
applied this Token patch
applied this core (!) patch

Now I'm running:

Pathauto 7.x-1.2+21-dev
Token 7.x-1.5+4-dev
Token Tweaks 7.x-1.x-dev
Menu Firstchild  7.x-1.1+1-dev

An additional detail:
Going to node/[nid]/devel/token for any given page hangs for a while, then displays a blank screen.  It produces three errors like this:

Notice: Undefined property: stdClass::$field_studio_location in addressfield_tokens() (line 219 of /var/www/html/test/sites/all/modules/contrib/addressfield/addressfield.tokens.inc).

This doesn't seem particularly serious, but maybe relevant.

Any ideas? Even pointers on how to debug would be great.


texts: Can I programmatically create a new node revision, without the new revision becoming the "current" one?

texts:
Whenever my feeds import finds a new version of an existing piece of content, it creates a new revision of this node instead of overwriting data.

Normally the new revision becomes the "current" one right away. I would like the currently displayed revision however to remain the same, and let a moderator decide later if the new one should be published.


texts:
I just tried to setup the RefreshLess module for my Drupal 8 site; after enabling it, I just see that some meta information is added to the DOM, but switching pages using links seems not to be effected in any way.

As written in the README file, I applied the patch to core.

How can I debug this?

PS: The refreshless.js file is not even loaded.


texts: Redirecting a registration link in logintoboggan

texts: I've got a register link and a log in link that is augmented by logintoboggan. All I want to do is redirect the register link from the user account form page to a new page I've just made. It seems very simple, but I can't find where the I can change the link. Any help would be amazing, thanks.


texts:
I am looking for a method to pass html to jquery dialog. Without success.

I try:

Drupal.jqui_dialog.html(messages);

And

        Drupal.jqui_dialog.open({
              data : messages
        });

But it doesn't work.


texts:
I am using autocomplete exposed filter in views for country/city with depth which is working fine but there are many identical city names.

When user types XYZ he sees 2 entries:
"XYZ"
"XYZ"
and has no clue which one belongs to which country.

I would like to show depth of the tree:
"ABC-XYZ"
"DEF-XYZ"
in autocomplete.


texts: Must implement interface > Drupal\Core\Entity\EntityTypeManagerInterface, none given in __construct() function

texts:
I am trying to write a custom eventsubscriber for commerce 2.x for an event after a successful checkout. Everything works and now I want to create a __construct function to initialize an object, but then I get the following error:

  TypeError: Argument 1 passed to
  Drupal\custom_module\EventSubscriber\OrderCompleteEventSubscriber::__construct()
  must implement interface
  Drupal\Core\Entity\EntityTypeManagerInterface, none given, called in
  /home/user/websiteName/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php
  on line 264 in Drupal\custom_module\EventSubscriber\OrderCompleteEventSubscriber->__construct()

I've tried explicitly defining the EntityTypeManagerInterface within the class, but everything is resulting in this error. Not finding anyone with any similar issues, and this particular block of code works for other people, just wondering what I am missing or If I am doing something incorrect. This code runs great if I don't construct an object with EntityTypeManagerInterfaceas the argument ... any ideas?

namespace Drupal\custom_module\EventSubscriber;

use Drupal\commerce_order\Entity\OrderInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\rng\RegistrantFactoryInterface;
use Drupal\state_machine\Event\WorkflowTransitionEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class OrderCompleteEventSubscriber implements EventSubscriberInterface {

  use StringTranslationTrait;

  /**
   * The registration entity storage.
   *
   * @var \Drupal\Core\Entity\EntityStorageInterface
   */
  protected $registrationStorage;

  /**
   * The user entity storage.
   *
   * @var \Drupal\user\UserStorage
   */
  protected $userStorage;

  /**
   * The registration access handler.
   *
   * @var \Drupal\Core\Entity\EntityAccessControlHandlerInterface
   */
  protected $registrationAccessHandler;

  /**
   * The registrant factory.
   *
   * @var \Drupal\rng\RegistrantFactoryInterface
   */
  protected $registrantFactory;

  /**
   * Drupal\Core\Session\AccountProxyInterface definition.
   *
   * @var \Drupal\Core\Session\AccountProxyInterface
   */
  protected $currentUser;

  /**
   * Constructs a new OrderCompleteEventSubscriber object.
   *
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   * @param \Drupal\rng\RegistrantFactoryInterface $registrantFactory
   * @param \Drupal\Core\Session\AccountProxyInterface $current_user
   */
  public function __construct(EntityTypeManagerInterface $entity_type_manager, RegistrantFactoryInterface $registrantFactory, AccountProxyInterface $current_user) {
    $this->registrationStorage = $entity_type_manager->getStorage('registration');
    $this->registrationAccessHandler = $entity_type_manager->getAccessControlHandler('registration');
    $this->userStorage = $entity_type_manager->getStorage('user');
    $this->registrantFactory = $registrantFactory;
    $this->currentUser = $current_user;
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    return [
      'commerce_order.place.post_transition' => ['buildRegistration'],
    ];
  }

  /**
   *
   * @param \Drupal\state_machine\Event\WorkflowTransitionEvent $event
   */
  public function buildRegistration(WorkflowTransitionEvent $event) {
    $order = $event->getEntity();
    // do stuff
      }
    }
  }

}

Services.yml File

services:
   custom_module_event_subscriber:
      class: '\Drupal\custom_module\EventSubscriber\OrderCompleteEventSubscriber'
      tags:
        - { name: 'event_subscriber' }


texts: Popup message showing content from a block

texts:
I have a block, and I want to display the content of that block into a popup message. This is my code.

function darksite_menu() {
  $items['admin/config/media/darksite'] = array(
    'title' => 'Pop up screen configuration',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('darksite_config_page'),
    'access arguments' => array('adminster pop up dark screen'),
    'type' => MENU_NORMAL_ITEM
  );

  return $items;
}

function darksite_config_page() {
  $form['darksite_status'] = array(
    '#title' => t('Enable pop up screen'),
    '#description' => t('When enabled, a pop up screen will be displayed on the home page.'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('darksite_status', 0)
  );

  return system_settings_form($form);
}

function darksite_block_info() {
  $blocks['popup_dark_screen'] = array(
    'info' => t('Pop up Dark Screen')
  );

  return $blocks;
}

function darksite_block_view($delta = '') {
  switch ($delta) {
    case 'popup_dark_screen':
      $block['subject'] = t('Pop up Dark Screen');
      $block['content'] = get_darksite_popup();
  }

  return $block;
}

function get_darksite_popup() {
  $popup_message_parameters = array(
    'title' => t('Information'),
    'body' => t('You have completed the work'),
    'check_cookie' => TRUE,
  );
  if (variable_get('darksite_status', 0))
   {
  // if the check box is checked.
   popup_message_show_message($popup_message_parameters);
    }
}

The code does not work. I have installed the model of popup message, but it still doesn't work.


texts: Can I strip my form of some classes and DIVs?

texts:
Can I strip my form of these classes and DIVs as shown in the code below?

<form action="/example/unsubscribe" method="post" id="exampleform-unsubscribe" accept-charset="UTF-8">

/** this div **/

/** strip these class and add my own class? **/
      E-mail address */** strip classes form-required from span **/
      <input type="text" id="edit-email" name="email" value="" size="60" maxlength="128" class="form-text required" />/** strip form-text and required class **/

    <input type="submit" id="edit-submit" name="op" value="Remove me!" class="form-submit" />/** remove form-submit class **/ <input type="hidden" name="form_build_id" value="formjKkl1KLWJLnv0hM4DSVd8-40boTgBQAzWWhUn44c15Q" />
    <input type="hidden" name="form_token" value="LB07DqsDXK9idWdOHLxUen7jKxm52JqTyHiR7-pNumA" />
    <input type="hidden" name="form_id" value="exampleform_unsubscribe" />

/** this div **/
</form>

Would it affect any form or ajax form functions of the form?


texts:
I am using the calendar module and I have added many events to it like a timetable.

How can I export these events as an excel format? So that I can see the whole calendar events in the excel file when I need.

Thank you in advance.


texts: Display specific node type in different path

texts:
I have created a new content-type Document Template. I need to display the contents of type Document template in a different path.

localhost/site_name/document_templates

not in

localhost/site_name.

What should I do?


texts:
I am trying to migrate a link field field_url from a Drupal 7 site to my Drupal 8 one. The link field is compound, it has a title and a url value. In my process plugin I am selecting the right values (field_url_title and field_url_url), but I don't know how to map them in my yaml definition file. What I have:

          field_url: field_url_url
          field_url_title: field_url_title

...maps correctly the url, but does not populate the title one. What's the destination field machine name I would need to use to add in the link title?


texts:
getting lock messages as.... “Waiting for table metadata lock” occurs in database whenever there is “truncate cache_entity_node” call execute.

How can we disable truncate action on entitycache module ?

We are having issues with “metadata locks” with the DB so performance continue to be an issue here.


texts: Multiple dates token for auto node title

texts:
I am using this token to create node title [node:field-date-concert:custom:j-m-Y] and it works fine if there is one value for date in node.

Problem is that if there are 2 or more values i only get first one displayed but would like to get them all.
So instead of just showing 05-05-2016 as node title, i would like to have 05-05-2016, 15-06-2016, 28-07-2016.


texts: How does Views Node Field module manifest itself in Views UI?

texts:
I've installed the Views Node Field 7.x-1.0 module, but can't figure out how to access its features in the Views UI.

Given an existing view, what are the steps to get to where I can add a Teaser as if it were a field?

I've verified that the Views Node UI module is active in the Updates report.

In a view, on a page, under Field I click on Add. If I try to search on teaser, nothing comes up.  If I filter on Field, I don't see any fields that seem relevant.


texts: Cycle comments on field--comment.html.twig

texts:
I would like to add a div for every comment on my field--comment.html.twig

On the template I've a "comments" variable, but if I cycle in this way, I obtain error (Fatal error: "0" is an invalid render array key in /var/www/html/core/lib/Drupal/Core/Render/Element.php on line 97):

{% for comment in comments %}
      {{ comment }}
  {% endfor %}

I would like to add "odd/even" class to comments.

[EDIT]
If I use a cycle like this:

{% for key,value in comments %}
  {{ dump(key) }}
{% endfor %}

keys are: #sorted, #pre_render, 'pager', '106', '107' (where 106 and 107 are comment ids)


texts: drupal 7: How do I add individual css elements to an existing module css so that if later on when this module css is updated when the module is updated my individual css are not deleted?


texts: Custom module search ranking not working + ranking admin settings not showing properly

texts:
I'm using a custom module, with custom content type and custom search implementations and ranking. To rank the results I'm using the votes cast for the posts. But the voting system is custom too, i.e. it uses a custom table and not a standard drupal table. Now the problem is that:

The ranking doesn't work at all. I have set an influence value(content ranking factor) of 1 in the search settings for the ranking.
You know the ranking factors I mentioned above, in the search settings? It will only list my ranking factor, if and only if I enable the node module in the Active Search Modules section. As you might have figured I have my custom module in the Active Search Modules enabled.

Maybe problem #2 is the cause of #1?

The code for the hook_ranking() implementation is as follows:

function knowledge_ranking() {
    return array(
        'post_rating' => array(
            'title' => t('Post Rating'),
            'join' => array(
                'type' => 'LEFT',
                'table' => TABLE_POST_VOTES,
                'alias' => TABLE_POST_VOTES,
                'on' => TABLE_POST_VOTES . '.pid = i.sid',
            ),
            'score' => 'vote.average / CAST(:max_rating AS DECIMAL)',
            //I also did the following:
            //'score' => 'AVG(vote) / CAST(:max_rating AS DECIMAL)',
            'arguments' => array(':max_rating' => 5),
        ),
    );
}

It's worth mentioning that I have cleared cache, rerun cron and re-indexed the site several times.

Any help or tips are appreciated, thanks :-)

Update 1:

Solved #2

You need to implement yourmodule_search_admin() and from there return that part  of the form.

Update 2:

I'm pretty sure that problem #1 lies within this line:

'score' => 'vote.average / CAST(:max_rating AS DECIMAL)',

So now I guess I have to put the average rating for each post in a field in the posts table. But there are gonna be a lot of more factors. So now the question is can't we use such complex scores at all?


texts:
I can get a list of node items by content type, using the following query:

$query = db_select('node', 'n');
    $query->condition('n.status', NODE_PUBLISHED);
    $query->condition('n.type', 'slider');
    $nids = $query
        ->fields('n', array('nid'))
        ->orderBy('changed', 'DESC')
        ->range(0, 4)
        ->addTag('node_access')
        ->execute()
        ->fetchCol();
    $nodes = node_load_multiple($nids);

I want to filter this output further with taxonomy. How can I do this?


texts: What would cause this error when upgrading Panels module?

texts:
$ drush up panels
Code updates will be made to the following projects: Panels [panels-7.x-3.4]

Note: A backup of your project will be stored to backups directory if it is not managed by a supported version control system.
Note: If you have made any modifications to any file that belongs to one of these projects, you will have to migrate those modifications after updating.
Do you really want to continue with the update process? (y/n): y
Project panels was updated successfully. Installed version is now 7.x-3.4.
Backups were saved into the directory /home/bzisad0/drush-backups/newco/20140724235906/modules/panels.       [ok]
WD php: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'newco.cache_panels' doesn't [error]
exist: TRUNCATE {cache_panels} ; Array
(
)
 in cache_clear_all() (line 165 of
/var/www/vhosts/www.companyname.com/releases/20131007153705/includes/cache.inc).
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &#039;newco.cache_panels&#039; doesn&#039;t exist: TRUNCATE {cache_panels} ; Array
(
)
 in cache_clear_all() (line 165 of /var/www/vhosts/www.companyname.com/releases/20131007153705/includes/cache.inc).
Drush command terminated abnormally due to an unrecoverable error.                                           [error]
Backups were restored successfully.                                                                          [ok]

The only clue I have is that the company I'm doing work for underwent a merger, and we had to set up the new web site before the name of the new company was public, so everything went by "newco".  I could not find anywhere that this is configured in Drupal, but I see that showing up in the error message "Base table or view not found: 'newco.cache_panels' doesn't exist".

I'm not sure if that's relevant or not, but I'm mentioning it just in case, and hoping it's not a red herring.


texts:
I try to create a condition that checks if user has already created a node.

I use this code which returns the last created node by the user. Adding simple if statement I can return true/false.

$xxx = db_query("SELECT nid FROM {node} WHERE (type = :type1) AND (uid = '123')", array("type1" => 'nodetype_x'))->fetchField();
return $xxx;

I tried to do it more efficient to check only for first result like this.

$xxx = db_query("
IF EXISTS(
      SELECT nid FROM {node} WHERE (type = :type1) AND (uid = '123')
)
SELECT 1
ELSE
SELECT 0", array("type1" => 'nodetype_x'))->fetchField();

But get syntax error. What would be the correct syntax? Thank you


texts:
I'd like a block plugin to display content dependent on a GET request.
Inside my block plugin I have

class BlogPage extends BlockBase {
    public function build() {
        $query = \Drupal::entityQuery('node')
            ->condition('type', 'blog_post')
            ->sort('created', 'DESC')
            ->range(0, $range);
        return $query;
    }
}

I'd like to make $range retrieve info from a GET request. For example I'd like
127.0.0.1/page?range=5 to make $range = 5.
I've tried

$range = Request::get('range');

But that does not work. Is there a way to return the values in a GET request from inside the block plugin?


texts:
How can I create a page in Drupal that doesn't appear in the Drupal configuration menu? For example: admin/config/handler, but the only way is the direct link. There is no link in the configuration menu. Which hook function should I use?

$items['admin/config/handler'] = array(
    'title' => 'Handler',
    'description' => 'Just some info here.',
    'access arguments' => array('administer site configuration'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('handler_form'),
    'type' => MENU_CALLBACK
);


texts:
This is my first time doing any custom module work in Drupal and need some advice.  I have a django background.

I am accessing data on an external non-Drupal server to display on the Drupal site.  I think I want to create a custom field type that holds the unique integer mapped to the data's ID on the external site.

  1) user visits /mymodule/1234 where 1234 maps to the external data
  source (not the drupal node)
  2) module performs a kind of
  get_or_create and either gets the node that matches the unique ID or
  creates one
  3) the user will see get a node returned to them (can
  handle comments, statistics, etc) that also displays the external data
  (which I will query via REST)

I'm basically asking for advice if this approach is tenable in Drupal and how to implement the get_or_create part of this if it is.

what I can imagine so far

First, custom module and a url handler:

<?php
function mymodule_menu() {
    $items['mymodule'] = array (
        'testing' => 'I am just testing',
        'page callback' => 'mymodule_view',
        'access callback' => TRUE,
        );
    return $items;
}

Then a custom view function to do the heavy lifting when user visits /mymodule/1234:

<?php
function mymodule_view($data_id = 0) {

    // custom REST function to get the data via the $data_id
    $data = get_my_data_cleverly($data_id);

    if (!$data) {
        //return 404
    }

    // not sure about this part
    get_or_create_node($data_id);

    // then return output to theme combining both node and $data
    // this is an oversimplified render array output that doesn't
    // work mostly because I don't understnand how Drupal does this yet
    $output =  array(
        'node' => $node,
        'data' +> $data,

    );
    return $output;

}

The result would be a node, with additional non-node information passed to the template.

Thanks


texts:
How do I remove the link to a user's profile on article content?  The  element is part of the article header and its classname is ".username".  I am new to Drupal but not to webdesign; I am just having trouble pinpointing which file to edit.

I tried:

function phptemplate_links($links, $attributes = array()) {
    unset($links['.username']);
    return theme_links($links, $attributes);
}

in my theme template.php file but it did not work.

Just to be clear: I am trying to remove the  element but not the text.  I still want the user's name to appear, just not the link to the profile page.  Also, I am looking for a PHP-based solution, not CSS, and trying to avoid adding any more modules.

Thanks!


texts: How can I create a field to hold data on users' countries and states?

texts:
I'm trying to create a content type that has multiple countries available to be selected and then multiple states/territories within those countries based on the country, but I'm not sure how to best accomplish this.

When a user is creating a piece of content they need to be able to select their country, then based on the country they select, they can select their state or territory with only those states/territories for that country available as options. I have two such countries that will have multiple states/territories - the U.S. and Canada.

I'm creating a text field using the field module that lists all the U.S. states when a parent item is selected using a list (text) and a "select text" drop-down. I also need to create a way to present the user with the Canadian territories when selecting Canada as the territory.

Right now I have two fields - "Country" and "State". Can you recommend the best way to accomplish presenting the user with the correct options for the state/territory based on their country selection? I'm drawing a blank on this one.


texts: How to render media shortcodes e.g [[fid:1234]]

texts:
I've written a custom database query to pull out taxonomy data in a specific way, the problem is embedded media shortcodes are outputting the shortcode strings as they stand in the database, rather than the content they represent.

e.g:  [["fid:"1234"]] instead of pdf.

The taxonomy body field can contain:

Embedded nodes ([[nid:1]])
links to other content (node/nid)
embedded media etc: pdfs ([["fid":"6247" "other_props":....]])

I've written regex to parse out the first 2 bullet points, and call _node_embed_replacements() & drupal_get_path_alias() respectively to insert the correct content for them, but i'm having a hard time working out where media module renders embedded shortcodes such as [["fid":"6247"]].


texts:
I would to know how I can run a drush command like drush @alias cc all with a gulp workflow ?

This is my starting code:

var plugins = require('gulp-load-plugins')();
    gulp.task('drush:cc', function () {

      return gulp.src(source)
        .pipe(plugins.shell([
          'drush @vmdevd6mg cc all'
        ]))
        .pipe(plugins.notify({
          title: "Caches cleared",
          message: "Drush Drupal CSS/JS caches cleared.",
          onLast: true
        }));
    });

Thanks
EDIt: another way to run drush but seem not to work too,no error message given.

// Run drush to clear the theme registry.
gulp.task('drush', plugins.shell.task([
   'drush @vmdevd6mg cc all'
]));

both tasks give:

gulp drush
Error: spawn drush @vmdevd6mg cc all ENOENT

EDIT1: New test

My new task and the result:

//Vidage de cache Drupal avec Drush
gulp.task('drush', function() {
  return gulp.src(basePaths.drushscript, {
      read: false
    })

    .pipe(plugins.shell([
      'drush @vmdevd6pf cron && drush @vmdevd6pf cc all'

    ]))
    .pipe(plugins.notify({
      title: "Vidage de Cache",
      message: "Cache Drupal vidé complètement.",
      onLast: true
    }));
});

Part of the global launch task:

gulp.watch(folderPaths.js.jsd68, ['drush']);

Give:

 /bin/sh: 1: drush: Permission denied

    events.js:160
          throw er; // Unhandled 'error' event
          ^
    Error: Command `drush @vmdevd6pf cron && drush @vmdevd6pf cc all` failed with exit code 127

EDIT: final gulp task work like
//Vidage de cache Drupal avec child_process - 2020-06

gulp.task('drush-cp', function(done) {
  return cp.spawn('drush', ['cache-rebuild'], {stdio: 'inherit'})
  .on('close', done)
   /*  .pipe(plugins.notify({
    title: "Vidage de Cache avec Drush",
    message: "Cache Drupal vidé complètement.",
    onLast: true
  })); */
  ;
});


texts: How do I receive and record Paypal transaction variables from POST?

texts:
I have a service I want my customers to subscribe to, and I want to be able to update a field within my DB based on their subscription. Was it cancelled? Did it successfully begin/recur?  I'd like to get this information, so I can perform the update within my database accordingly.

I would like to capture the transaction variables that Paypal POSTS to a specified successful payment URL, but I have no idea how. I obviously need to create a page that does this, but I'd like to know what I need to do.


texts: Give a role permission to add and edit their terms in a taxonomy

texts:
In Drupal 7 I am trying to give users the ability to add terms to a taxonomy and then edit only the terms they have created.

I'm using the Taxonomy access fix module to give users permission to add terms in specific taxonomies. However, Drupal does not provide an "edit own terms" permission like it does for nodes. Users can either edit all terms in the taxonomy, or not have editing permission.

Is there any solution for this?


texts: How to display the translated value of a boolean field when viewing a translated page?

texts:
I have this problem with translation of a custom checkbox (boolean) field. To be specific, I'm able to translate everything but the options (Yes / No) that are shown on node view page.

I have the modules locale, i18n_nodes, and i18n_fields enabled, and translation strings imported (with corresponding context and to appropriate textgroup), and default language set to English. The translation shows correctly everywhere but on node view where it's still untranslated.

The content type is custom and is created via hook_node_info() and it's fields via field_create_field, and field create_instance.

BTW: I don't need translation of the content (every node will always have just one language and should be accessible regardless of what language the user has selected) but only of the user interface (descriptions, titles, ...). So if there's a simpler way to translate my custom fields and content types, please let me know.

Screenshot proofs that I've done everything I could:

Settings:

Edit page:

View page (note the only string that is in English but should be in Czech and should be Aktivni)


texts: How should I define a MENU_LOCAL_ACTION menu item, and which is the involved page callback?

texts:
Looking at user_menu() to check the answer for another question, I noticed the function contains the following definition.

  $items['admin/people/create'] = array(
    'title' => 'Add user',
    'page arguments' => array('create'),
    'access arguments' => array('administer users'),
    'type' => MENU_LOCAL_ACTION,
  );

The page callback is not explicitly defined.

Reading the definition of MENU_LOCAL_ACTION given in hook_menu(), I read  the following:

  MENU_LOCAL_ACTION: Local actions are menu items that describe actions on the parent item such as adding a new user or block, and are rendered in the action-links list in your theme.

That doesn't explain which is the involved page callback that is called to handle that menu item.

Which is the page callback that is called to handle a MENU_LOCAL_ACTION menu item? Is there any other property that is necessary to define such menu items?


texts:
I have created a view with two exposed forms based on filter criteria and the sort criteria. I would like to display the sort criteria in the actual view and the filter criteria as a block.But when i save the view i get these two forms either as a block or as a view content.
Can any one help me to display the filter criteria as a block and the sort criteria as a actual view?


texts: Create a view based on node reference field

texts:
There are two content types Gallery and Image. Image has node reference field (node reference from url). Gallery doesn't have any node reference fields.

By using views I can show all related images on a gallery page (I use node reference field "field_pers_gallery" as a contextual filter).

At the same time I need to create a view to show all images related to one gallery (all images have the same value in field field_pers_gallery) on a page of every image. I would like to create a view that looks like Flickr  image page with related images. I have the problem with it because I cannot choose the right contextual filter to create the view as I want.

I tried the following examples but nothing helped me, I cannot understand why.

http://drupal.org/node/370227#comment-4364810
http://drupal.org/node/370227#comment-5699610
How can I build a view that shows other nodes that reference the same node the current node references?

Could anybody help me with any advices?


texts: Date API not accepting date format in a view filter

texts:
I'm using Availability Calendars and Date API modules and I need to filter views using the availability data. The module provides a view exposed filter which allows to choose an arrival and a departure dates. The problem is that when a date is chosen in the filter and the request is sent, a warning message appears saying:

  The value input for field Arrival date is invalid: The value 11 does
  not match the expected format.

Its using the d/m/Y (15/02/2016) format in the field. If i change the parameters sent via GET in the url to Y-m-d format (2016-02-15) the message changes a little bit but still not working:

  The value input for field Arrival date is invalid: The value 2016-02-5
  00:00 does not match the expected format. The value input for field
  Departure date is invalid: The value 2016-02-15 00:00 does not match
  the expected format.

When I check the Drupal logs, the error messages point to Date API module:

  Warning: strlen() expects parameter 1 to be string, array given in
  date_default_date() (line 115 of
  /var/www/vhosts/drupal/litoral.interdigital.biz/sites/all/modules/date/date_api/date_api_elements.inc).

  Warning: strlen() expects parameter 1 to be string, array given in
  date_default_date() (line 114 of
  /var/www/vhosts/drupal/litoral.interdigital.biz/sites/all/modules/date/date_api/date_api_elements.inc).

  Notice: Undefined index: time in date_popup_input_date() (line 626 of
  /var/www/vhosts/drupal/litoral.interdigital.biz/sites/all/modules/date/date_popup/date_popup.module).

The first two warnings appear twice every time a request is sent which looks like they're triggered by both arrival and departure dates. The last one occurs only once.

I've been Googling for the problem and I found some references to invalid dates and Date API but they weren't very useful to me. I tried to define date formats in the as shown in: https://www.drupal.org/node/2243009 but nothing happened.

Edit:

I followed the issue to the date_api.module and the parse function (line 596). That function defines the error message "The value 2016-02-15 00:00 does not match the expected format" . from here I coukld obtain the $format parameter of this function and I've seen that it's "Y", I tried to pass years as GET parameters for the function but still nothing. If i force the $format to be "d/m/Y" or "Y-m-d" the message changes to:

  The value input for field Arrival date is invalid.

  The value 2016-02-15 00:00 does not match the expected format.

  The day is missing.

  The month is missing.

  The year is missing.

  The hour is missing.

  The minute is missing.

  The value input for field Departure date is invalid.

  The value 2016-02-15 00:00 does not match the expected format.

  The day is missing.

  The month is missing.

  The year is missing.

  The hour is missing.

  The minute is missing.


texts: Get the return value of a hook defined in a module?

texts:
Is there a way to get the return value of a hook defined in a particular module for eg:

$views_theme_hook = module_invoke('views', 'theme');

By using module_invoke function, I got an array of themes declared in views module. Is this proper way of doing it?

But this function needs arguments for some other hooks for eg: hook_tokens.

How could I get the result for hook_tokens and other similar hooks requiring arguments?


texts: Is _access: 'TRUE' mandatory for a public route?

texts:
I want a route to be accesed by everyone (logged in or not).

I removed the requirements and still I was seeing Access Denied.

It worked only when I put _access: 'TRUE'. Why is this mandatory? Should not default to public when no requirement is set?


texts: What are my options for a url based cache tag?

texts:
I have a controller that serves a path, /get-messages, which requires a query argument, path. An example request to this path will look like /get-messages?path=/about/team.
I have a content type, Message. Each message has a textarea field that allows the editor to enter paths that the message should appear on. Example content:
/about/team
/about/*

With javascript, on page load, I make a request to my controller, e.g. /get-messages?path=/the/current/path, to get all messages that should be displayed on the current page.
This all works fine and is no problem. The issue I'm having is with how to cache my responses correctly.
With core's default caching options, I might setup a cache render array like:
[
  'keys' => ['my_module_get_messages'],
  'contexts' => ['url.query_args'], // or `url.query_args:path`
  'max-age' = Cache::PERMANENT,
]

I can even add any message entities as cache dependencies to make sure their cache tags get added and the cache is broken if they're edited. This also works fine.
The issue I'm having is if someone adds a new message that should display on a path that's already cached, by default, creating the new entity won't clear the cache for any already existing cache entries.
I think I need a cache tag based on my url. Is there an existing cache tag I can use, or do I need to create/manage my own custom tags (as described in Implementing Custom Cache Tags)? Or an alternative caching approach?


texts: How to separate the links of the variable $links (in nodes and comments) to be able to place them in various places?


texts: How do I show a progressive number such as "Item 1 of termName", "Item 2 of termName"?

texts:
I have a vocabulary with 4 taxonomy terms. There is a content type with a taxonomy reference field for that vocabulary.
I have a view that is pulling a list of all these nodes on a page. My design calls for the list to display to which taxonomy term the nodes belong, along with a progressive number.

Each node shows Issue #, where the progressive number shows which node was created first for that taxonomy term.
I thought being able to use tokens in view fields would help, but it seems it isn't currently possible, reading Provide Field item that supports Text Filters.
Does anyone know of a way to accomplish this without writing custom code?
I saw Node count for taxonomy terms, but that's about showing a node count, while I want to show a progressive number.


texts: How to give moderator a right to publish or unpublish/edit any comment , not just own comment or  comment on own content without giving "Administer comments and comment settings" Permission, by giving just a tab for publish and unpublish for appropriate role ?


texts:
I installed the Login Security module to block IP address for more than 4 number of login attempts, but unfortunately my IP blocked.

I tried uninstall the module, but still my IP address blocked. How to remove ban for my IP address. It shows the message Sorry, 00.000.00.00 has been banned.

I'm using Drupal 6.


texts: Print custom field in user edit form in block

texts:
Following code prints user edit form in block:

function notifikacie_custom_block_info() {
 $blocks['user_profile'] = array(
   'info' => t('User profile edit'),
   'cache' => DRUPAL_NO_CACHE,
 );

 return $blocks;
}

function notifikacie_custom_block_view($delta = '') {
  $block = array();

      global $user;
      module_load_include('inc', 'user', 'user.pages');
      $block['subject'] = t('Fill your profile');
      $block['content'] = drupal_get_form('user_profile_form', $user);

  return $block;
}

But it does not print custom fields created in admin/config/people/accounts/fields. How do I print those custom fields?


texts:
I have this code:

$items[$k]->user->nome = $accounts[$item->uid]->field_nome['und'][0]['safe_value']." ".$accounts[$item->uid]->field_cognome['und'][0]['safe_value'];

And the output is this:

L&#039;itto Giovanni

But I want (in HTML)

L'itto Giovanni

in html head I have

 <meta charset="utf-8">

Where is my error?


texts: Create custom entity with an attached field

texts:
I need create a Table to store one text field for node, attach input for this field to all node add/edit forms and store/update/delete its value in database on all appropriate node operations.  (Do NOT use Field API).

How can I do that?

Any ideas?


texts: How can I bootstrap a multi-site instance?

texts:
It's possible to bootstrap Drupal 8 and create a new node using answer # 174474.
define('DRUPAL_DIR', '/usr/share/nginx/html');

use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;

require_once DRUPAL_DIR . '/core/includes/database.inc';
require_once DRUPAL_DIR . '/core/includes/schema.inc';

// Specify relative path to the drupal root.
$autoloader = require_once DRUPAL_DIR . '/autoload.php';
$request = Request::createFromGlobals();

// Bootstrap drupal to different levels
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
$kernel->boot();
$kernel->prepareLegacyRequest($request);
$em = $kernel->getContainer()->get('entity.manager');

$entity = $em->getStorage('node')->create([
  'type' => "article",
  'title' => "test entity",
  'body' => "body body body",
]);
$entity->save();

Is it possible to bootstrap a subsite database when using multisite to create the new node in a specific subsite?
In Drupal 7, this can be done by using the function drupal_override_server_variables, but this function doesn't exist in Drupal 8.
I also tried modifying the $_SERVER['HTTP_HOST'] and $_SERVER['SCRIPT_NAME'] variables according to this forum post, with no luck.


texts:
In my content type I have a products field (entity reference) which references other content types (product content types).
What I want to do is each product field has to have a specific option set, and on the node add form the user can choose a product with a specific said option. Example:

Product: Food package A
Options to choose from: Set A, Set B, Set C, etc.

Product: Food package B
Options to choose from: Set A, Set B, Set C, etc.

My Goal:
Choose product: Food package A
Choose option: Set A

I tried editable fields but what happens is the user edits the original product content. BTW I'm not using any commerce module.

Any help would be greatly appreciated!


texts: Include content on module install of a custom block

texts:
I'm using Features for creating a custom module that installs and places blocks on my site, but Features doesn't export content and in this case the block contents will be needed.

I'm trying figure out how to include custom block's content somewhere in my module to my custom blocks appear with some content (to allow editing in 'custom library page') or somehow populate my custom blocks after module install with a automate tool.

PS: From now, I've putting content after module install using mysqldump (export site A, insert site B), but its not safe procedure.

Any hints are appreciated.


texts: Conbine two content types in views by proximity

texts:
Given two content types A and B, both with geolocation field, I would like to create a view, in which each node of type A is connected with the nearest node of type B (by proximity).
The closest solution I have been able to find is this one:
https://www.drupal.org/docs/contributed-modules/geolocation-field/how-to-create-a-nearest-node-view-sorting-by-proximity
I am using D8.
Can anyone point me in the right direction.
Thanks


texts: How to name views-exposed-form.tpl.php per views display

texts:
I tried views-exposed-form--"view_name"--"display_name".tpl.php but it doesn't work. Is it possible to make a template file which applies only to the exposed filter of a views display?

I have two exposed filters from two different displays within a same view, and I would like to theme the two exposed filters differently by two template files.


texts: I don't know if this is the right forum, but I'm updating our corporate website, and picking up where the previous person in my job left off. From the main horizontal menu on the front page (newsletters, programs and services, departments, doing business, etc), I am clicking on "Programs and Services" which takes me to the page screencapped below. The individual items shown on this page "Counselling, Youth Program, etc" are linking to pages that I want to get rid of and replace with pages I have built elsewhere on the site. I can't seem to figure out where to go to edit these. Ideally I'd like to get rid of the drop-down filter menu entirely and just have links to the pages I have alreayd built for the topics elsewhere within the site.  Any help?


texts: How to create a "Make this Sticky" link or tab

texts:
I need faster way to promote a node I'm looking at.

I usually go for:

"Open node view page"  (IE: https://example.com/node/123)
"Click Edit"  (IE: https://example.com/node/123/edit)
Scroll down
Click "PROMOTION OPTIONS"
Tick the Sticky option
Scroll (again)
Save node

Is there a faster way than that? The idea is to have a "Make this sticky" tab or link.


texts: How to know user submitted first content of a specific type?

texts:
I used Rules module to know when a user has logged in and notify the user about his/her login event.

Now I just want to check when the user has submitted a content of one specific type for the first time, so I just can understand when the user has submitted his/her first content of a speccific content type!

How can I modify my rule in Rules to implement this?


texts: Show all values for a field collection in node.tpl.php

texts:
I have a problem with theming field collection. I want to create a loop and I have a field called field_earth inside field_helloworld that displays unlimited images. The following code doesn't show any image.

<?php
  $counter = 1;
  foreach ($node->field_helloworld['und'] as $key => $value) {
    $field_collection = entity_load('field_collection_item', array($value['value']));
    $idx = $value['value'];
?>

    <?php print $counter; ?>
    <?php print $field_collection[$idx]->field_venus['und'][0]['value'];?>

    <?php print $field_collection[$idx]->field_earth['und']['0'][value];?>

  <?php $counter++; ?>
<?php  } ?>

Can anyone show me how to display all images?


texts: Split commerce cart to multiple orders per product

texts:
What's a solution in Drupal Commerce to create an order per product in cart during the checkout?

The cart looks like this:

Product A, Quantity: 2, $100
Product B, Quantity: 1, $199

Total: $399

The order-output should be:

Order #1: Product A, Quantity: 2, $100, Total: $200
Order #2: Product B, Quantity: 1, $199

So instead of the usually created single order that contains all products in the cart, the goal is to create an order per product in the cart.

Could a checkout rule solve this? Or a custom module, and if, how?


texts: Possible for Views to format a table with multiple rows as needed?

texts:
What I have is a basic content format of item, index, description

+----------+---------------------+
|  index   |  item               |
+----------+---------------------+
|  description                   |
|                                |
+--------------------------------+

The Content type: Manage field wizard has an option to allow multiple instances of a field in a node. It's a real help for my content. Now, I wish to create a View to display this content in a table (Views: Fields: Table: Settings), that will add rows to the basic form above as needed (according to the node's field limitations)

+----------+---------------------+
|  index   |  item               |
+----------+---------------------+
|  description                   |
|                                |
+----------+---------------------+
|  index   |  related item       |
+----------+---------------------+
|  index   |  related item       |
+----------+---------------------+
|  ...     |  ...                |
+----------+---------------------+

* (I'm using a table because I'm also using Draggableviews)

I've found Views Secondary Row Module, yet the idea is to accommodate any number of related items.

Any suggestions?

Its not particularly necessary to use table, now that I think of it, because the draggable view admin page doesn't need to be well formatted. The content does seem to want to be an a table, as I've described, but its not necessary.


texts: How can I programatically change the (D8 core) workflow state of an entity with Content Moderation?

texts:
I'm using Drupal 8.4-rc2.  When you enable the Workflow and Content Moderation modules, you automatically get the Editorial Workflow as a demonstration.

The states are as follows:

Archived
Draft
Published

And the transitions are as follows:

Create new draft (from draft/published to draft)
Publish (from draft/published to published)

How can I programatically call a transition?  Or, how can I programatically change the state without calling a transition (although this seems to violate the spirit of having transitions defined in the first place)?

Specifically, I have a node subject to content moderation (states: archived, draft, published).  By default, on the edit node page, the node is saved in the original state (so a draft node is saved as a draft).  I want to add a second button "save as published" with a submit handler, but I don't understand how I can programatically change the state.

What I do understand so far is that workflows are entities and so are states, so it's different than Drupal 7 in which most workflow-type modules used fields to track what was going on.

I checked the Examples module but there's nothing on configuration management/workflows yet.


texts: Disable email registration requirement in Drupal 7

texts: I've already removed e-mail validation, but the requirement that each user supply a unique e-mail address needs to be removed too. How can I go about doing that without resorting to a messy workaround like dummy e-mail addresses (which cause problems like making contact forms silently fail)?


texts:
I have created a custom callback to perform some batch operation.
How can I set schedule for execution using elysia_cron?


texts: Taxonomy view - showing term searched for in header

texts:
I've enabled the Taxonomy View template and used the taxonomy term page module to specify this view should be used when clicking on one of the taxonomy terms.

The page itself is working & looking great, but I'm struggling to show the vocabulary and term used in the header region.

Current view setup:
https://www.dropbox.com/s/j38nsznel93eoz3/Screenshot%202014-10-22%2022.56.28.png?dl=0

I'm hoping to use one view for all the different vocabularies - but wanted to show in the header e.g.

All articles tagged [author name]  - where the vocabulary used is 'author'

or

All articles tagged [project] - where the vocabulary used is 'project'

Anyone give me a pointer?


texts: Product reference add to cart form shows only add to cart button

texts: I've created a content type with a product reference field, but when I create a content with the reference to the product, it shows add to cart form with only add to cart button. I wanted to display Price, quantity, and product attributes on the add to cart form. I've searched a lot to find out any configuration for this, but no luck. Can anyone please help me regarding this?. It works fine in Drupal 7, but in Drupal 8 there is no way I can set up the form.


texts: Fatal error when restoring PostGreSQL DB from dump: undefined function system_run_automated_cron

texts:
I'm trying to simply install Drupal 7.8 on PostGreSQL 9.1, backup the DB, and then restore from it ... nothing else, just to test out backing up my sites, but the site will not come back up!

Here are my steps:

install Drupal & get through configuration to the "you're done" screen
dump the DB (pg_dump > file.sql)
drop the DB (dropdb)
create a new DB with the same info (createdb)
restore the DB (psql < file.sql)

No steps in between (except when I've tried to avoid the error by putting the site into maintenance mode and/or clear the cache). No adding content, no nuthin'!

But when I access my site, I get the following error message:

[22-Nov-2011 17:07:44] PHP Notice:  unserialize() [function.unserialize]: Error at offset 0 of 1009 bytes in /Applications/MAMP/htdocs/drupal-postgres/includes/cache.inc on line 405
[22-Nov-2011 17:07:44] PHP Notice:  unserialize() [function.unserialize]: Error at offset 0 of 38585 bytes in /Applications/MAMP/htdocs/drupal-postgres/includes/cache.inc on line 405
[22-Nov-2011 17:07:44] PHP Warning:  Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/drupal-postgres/includes/module.inc on line 185
[22-Nov-2011 17:07:44] PHP Warning:  array_keys() expects parameter 1 to be array, null given in /Applications/MAMP/htdocs/drupal-postgres/includes/module.inc on line 89
[22-Nov-2011 17:07:44] PHP Notice:  unserialize() [function.unserialize]: Error at offset 0 of 38585 bytes in /Applications/MAMP/htdocs/drupal-postgres/includes/cache.inc on line 405
[22-Nov-2011 17:07:44] PHP Warning:  Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/drupal-postgres/includes/module.inc on line 185
[22-Nov-2011 17:07:44] PHP Warning:  array_keys() expects parameter 1 to be array, null given in /Applications/MAMP/htdocs/drupal-postgres/includes/module.inc on line 89
[22-Nov-2011 17:07:44] PHP Fatal error:  Call to undefined function system_run_automated_cron() in /Applications/MAMP/htdocs/drupal-postgres/includes/common.inc on line 2573

Anyone have any thoughts? This CAN'T be this hard!

Thanks a million!


texts: Passing values in view block to contextual filter on Panelized Node

texts:
I have a view set up with a contextual filter for year (select list field).  I want to have the ability to have one view and pass the year to the view.

Now I have panelized nodes that I add the views to and I want to pass different years to each view.   In Drupal 7 I used to be able to do this with View Panes.  Is this not possible in Drupal 8?


texts: When Num of Values is "Unlimited", create begins with two instances

texts:
I've created a custom module for a field in drupal that has two fields, Position and Affiliation.  I add the field to my test content, and set Num of Values to "Unlimited".

The Problem:

When I go to create a new instance of test content, instead of seeing one instance of my field and the "Add another item" button, it starts with two (see image) and the "Add another item" button.

If I set the Num of Values to 1, I only get one.  If I click "add another item", it only adds one.  I'm looking at my code, and for the life of me cannot figure out where the problem can be.  I assume it's something in the widgit.

function pos_aff_select_field_widget_info() {
    return array(
        'pos_aff_select_widget_default' => array(
            'label' => t('Affiliation and Position default widget'),
            'description' => t('Drop Down Menu for Affiliation and Position'),
            'field types' => array('pos_aff_select'),
            'behaviors' => array(
                'multiple values' => FIELD_BEHAVIOR_DEFAULT,
                'default value' => FIELD_BEHAVIOR_DEFAULT,
            ),
        ),
    );
}

function pos_aff_select_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element){
    $base = $element;

    if($instance['widget']['type']  == 'pos_aff_select_widget_default') {
        $element['position'] = array(
            '#type' => 'select',
            '#title' => t('Position'),
            '#default_value' => isset($items[$delta]['position']) ? $items[$delta]['position'] : NULL,
            '#options' => pos_aff_select_query("ibs_position"),
        );

        $element['affiliation'] = array(
            '#type' => 'select',
            '#title' => t('Affiliation'),
            '#default_value' => isset($items[$delta]['affiliation']) ? $items[$delta]['affiliation'] : NULL,
            '#options' => pos_aff_select_query("ibs_affiliation"),
        );
    }
    return $element;
}

Does anyone have any clue what is going wrong?


texts: Create a content type node programmatically

texts:
I have a content type called ip_range and i was trying to create a node programmatically . I tried the follows :

use \Drupal\node\Entity\Node;
use \Drupal\file\Entity\File;
    $data = array(
      'type' => 'ip_range',
      'title' => '192.168.7.100/24',
      'field_ip_range_gw' => '192.168.7.100',
      'field_ip_range_hidden' => '',
      'field_ip_range_blocked' => '192.168.7.200',
      'field_ip_range_access_type' => 'Blocked',
      'field_ip_threshold' => '20',
      'field_ip_range_sec_zone' => 'C2',
      'field_ip_range_vlan_name' => 'Network58',
      'field_ip_range_vlan_tag' => '4054',
      'field_ip_range_comment' => 'Ip ranges from 192.168.7.100 to 192.168.7.255',
    );
    $node = Drupal::entityManager()
      ->getStorage('node')
      ->create($data);

    $node->save();

But its not creating any . Any idea ?

UPDATE

Its creating the node . But its creating as anonymous user . So i cant see it in front end . That was the problem . How to create it as a admin user ?


texts: Cannot import multiple nodes in feeds module using csv files

texts:
Im trying to import these files into nodes in my drupal 7 site

i used the no header and i mapped the columns into numbers (0,1,2. ..)

but i end up only getting only 1 node.

The alert says "created 1 node, updated 19 nodes" how come?


texts:
I have been trying to theme my taxonomy page output following this tutorial

http://mustardseedmedia.com/podcast/episode31

The tutorial suggest using taxonomy_term_page.tpl.php to override the default output and embed a view.

Unfortunately I have not been successful.  It seems that taxonomy_term_page.tpl.php is totally ignored.

I thought I had a solution when I started using page-taxonomy-term.tpl.php instead, this seems to get picked up however $tid is not passed to this template so I am unable to pull the taxonomy items.

I am using drupal 6.26.

EDIT

According to the video tutorial

Step 1) Create a blank file named taxonomy_term_page.tpl.php within theme folder

Step 2) Navigate to a taxonomy page.  This should produce a page (with headers and footers) but no actual content, since taxonomy_term_page.tpl.php overrides the taxonomy output and this file is currently empty.

It is at Step 2 that I am stuck.  The taxonomy pages return a page filled with taxonomy nodes, it seems that taxonomy_term_page.tpl.php is being ignored.  I have flushed all caches and I cannot seem to figure out what is outputting the current content.

SOLUTION (a bad one)

Since I have spent so much time on this I decided to scrap the idea of using taxonomy_term_page.tpl.php because in my setup it simply wasn't overriding the taxonomy pages.

Instead I am using page-taxonomy-term.tpl.php which does override the taxonomy pages in my setup.  However the downside to this is that this template does not have $tids available to use as required by the tutorial.  So to get this I have used the following code in page-taxonomy-term.tpl.php

$splode=explode("/",$_GET['q']);
$tids[]=$splode[2];

It essentially takes the query string in the url which looks like taxonomy/term/10.  Then explodes the string by slashes and uses the last portion for it's tid.

It's nasty, disgusting, but I'm in a rush. If anyone has a better solution, I'd love to know.


texts: Modifying contextual filters to display user name

texts: I have a view that takes one contextual filter for a UID. I would like to make the title of the page include the user name? My closest bet it the "Override title" option under "When the filter value is  in the URL or a default is provided". However, it appears that the only tokens available there are for the plain filter values, but I need the user name (as opposed to the UID). Is there a way to do this?


texts:
I have a content type of "Class" that has a date field attached to it field_class_date.

When a node of the type "Class" is viewed, I would like to display links to other classes that are on the same day of that particular class.

I tried doing this with views, but couldn't quite figure it out.


texts: Building a username search by writing custom module

texts:
My module simply allows a user to type in a user ID # in a field and hit the submit button.  The page should return the username.

function usersearch_form_submit($form,&$form_state) {
  $query = "SELECT name FROM users WHERE uid = :uid";
  $result = db_query($query,array(':uid' => $form_state['values']['uid']));
  foreach($result as $user) {
    echo "The username is $user<br>";
  }
  $form_state['rebuild'] =  TRUE;
}

Nothing really happens after I hit the submit button.  I get sent back to the form as if nothing happened.


texts: Comments are showing Anonymous commenter name

texts: I am working on comments module. I have requirement to display comments in chronological order, for this I have used Comment goodness module and suddenly comments started getting posted anonymously. Even after I removed this module Anonymous name showing on each comment and even this is authenticated user. I have disabled "User verification status in comments" in appearance. But still it is showing Anonymous.


texts:
Captcha and any form of page caching don't get along. I understand why this is, but i'm wondering if there might be a certain setup to use captcha even in cached environments.

Post requests for example are not cached in most cases. So using a captcha on a separate page right after the form submission that you intend to spam-protect should be possible in this case. Your first submission will only be validated if your captcha submission is valid.
   A 2-step validation, like cqcounter lookup form.

I can't find any examples where this is used in a cached drupal setup. Can this be done in drupal with captcha, or is holding a form submission while a second form is not validated not possible?


texts: How to Display a Single Image Gallery per Album in Content Teaser?

texts:
I have made a Hierarchical Photography site using Views, Panels and Organic Groups.

The Hierarchy is as follows:

Top-Level: Category (e.g. - SCENIC, STREET SCENES, MODELS )
Sub-Level1: ALBUMS | (e.g."BROOKLYN" and "Mid-Manhattan | July 2016" under STREET SCENES Category)
Sub-Level2: IMAGE GALLERY (e.g. "Commercial and Residential" and "Midtown Streets" under MANHATTAN Album)

Using Views, I am able to display a preview using a single image from the Gallery, of each Image Gallery under its respective Album.  See attached "album view" screenshot..

One the Category Level, I am trying to create a preview image of each Album using a single image from one of the image galleries in each Album to represent that Album on the Category page, but instead it displays all the image galleries from each album.  See attached 'category view" screenshot....

In both views, I am using Panels on the pages to help structure them.

Here is my View for the Category Level:

and my ALBUM TEASER VIEW

and finally my Image Gallery View....

Any ideas on how to ensure only one Image Gallery per Album appears on the Category Level when using Content:Teaser?  Thank You!


texts:
I want control over the order in which roles' columns are displayed on the Permissions page..

I want to add code to my module installation file so that, after newly-configured roles' yaml settings have been applied (they list the permissions for each new role), it displays all the roles in the order I want.

How do I do this?

Motivation

The roles' yaml settings are part of a module created by Features.
Enabling the module in the target Drupal 8 system adds the new roles in the wrong order.

It is not possible to include the weights of the anonymous; authenticated and Administrator roles in the feature / module's yaml files as this causes a conflict that prevents the module from being enabled. So the solution is to apply the weights programmatically.

[edit] I mistakenly thought that the order of the roles' columns related to an hierarchy / inheritance of permissions. Corrected by @Berdir, thanks. Nevertheless I still want to display the roles' columns in the way I choose, so I have edited this question to reflect this.


texts: CKEditor 4.3.1 - Notice: Undefined index: DOCUMENT_ROOT

texts:
CKEditor runs on 7.23 on a local osx 10.8.5. Configured as described in readme.txt without CKFinder.

Editing the CKEditor Profile brings the following:

"Notice: Undefined index: DOCUMENT_ROOT in ckeditor_get_document_root_full_path() (line 58 of /Users/ip/Sites/drupal-vzbv_docs_drupal_7/sites/all/modules/ckeditor/includes/ckeditor.lib.inc).

Creating a new article doesn't show the CKEditor

Google couldn't find any suggestion.

Any ideas?


texts: Remove dots ( ... ) from default search results descriptions ( snippet )

texts:
I want to remove dots from search results items descriptions to search result page ( Default Search ), i have used Drupal default search for the search result page so how to remove the dots from the search descriptions.

I tried with search and replace function using theme preprocess search result function but no luck.

  theme_preprocess_search_result()

function theme_preprocess_search_result(&$variables) {

  $variables['search_excerpt'] = str_replace("...", "", $variables['snippet']['#markup']);

}

But it's not work as expected,if have any solution please put into comment.

Thanks in advance.


texts:
I have a form that I'm creating and I'd like to get rid of the 'Add contract' button that is being put there automatically.
Is there something different I can do here:

function my_module_theme($existing, $type, $theme, $path) {
  module_load_include('inc', 'my_module', 'includes/admin/my_module.admin.forms');

  return array(
    'my_module_setup_form_contract' => array(
      'render element' => 'form',
    ),
  );
}

Or is there some other hook I can use?  I've been looking in the theme_my_module_setup_form_contract and my_module_setup_form_contract, but it looks like it's too late there.

This is for 7, btw.


texts:
I have 2 parallel Drupal Web Servers running (serving for one Drupal Instance together) and now i need to install NFS. My experience in multi Drupal Servers is, each Drupal Instance (Server) uses their own Aggregated JS + CSS files (storing in: sites/default/files/js and sites/default/files/css folders) which can NOT be used as common. (Files can not be the same for both Servers. They use their own ones.)

Based on these issues, my questions are:

How NFS actually works between Multi Drupal Servers?
Which directories will be/need to be shared between?
What will happen to Aggregated Files?
What will happen to Web User Uploads paths and files? (Need any configuration in Drupal?)

Can anyone share these knowledge/experience please?


texts:
I want to be able to add and remove a role to a user via a simple click of a button on almost any node. (Specifically the plan is to allow a user to give themselves a role that would give them extra editing powers, but so that they can remove it when generally browsing the site so all the editing options don't clog up the UI).

The best method I could think of for this is to have two nodes, and set up a rule so visiting these nodes added or removed the user role. I could then create simple menu links that linked to these nodes.

Essentially what I have set up is one rule which goes:

Event: Content is Viewed
Condition: Node is of alias - node url
Action: Add user role - Edit Powers

This rule works fine. When the node is visited the role is added to the user. However the reverse rule doesn't work despite being nearly identical to the other. It reads:

Event: Content is viewed
Conidtion: Node is of alias - node url
Action: Remove user role - Edit Powers

However visiting this URL doesn't remove the user role. The question here is two-fold.

a) Why would the rule not be working, and why can't it remove a role from the user?

b) Is this a really complex way of achieving something that might be quite simple? At the moment I assume this rule is effectively being checked when any user visits any page, which I'm sure isn't great from a resource point of view - but I couldn't think of an easier way to do it with flags etc. So please do advise if there is an easier way.

Thanks in advance for any help.


texts: Core JavaScript is not included in all pages

texts:
I'm developing a theme in Drupal 8. This is my theme.libraries.yml file:

default:
 version: 1.x
 css:
  theme:
   css/bootstrap.css: {}
   css/style.css: {}
   css/font-awesome.min.css: {}
   css/animate.min.css: {}
 js:
    js/galip.js: {}

When I try to view the source of the front page page, I see the JavaScript files like ready.min.js. jquery.min.js, jquery.once.min.js which I don't see in the login page and other pages.

Why is this happening? How do I include the core JavaScript files in all pages?


texts: Drupal 7 / Webforms: Combine Submission data from multiple webforms?

texts:
I'm working with multiple forms that have the exact same format; I need to combine the results into one result.

Is there a way to combine submission data from multiple webforms?


texts: Need help with PHP: Show an image field when video field is empty

texts:
I have been working with Drupal for some months now but I have not coded anything in it so I need help.

Situation: On my homepage there are 3 rows that contain blog teasers. On the first row the first video (youtube/vimeo) and the first image of the blog is shown. They are all styled responsively and it works fine. I use a view to do this.

What needs to change: When there is a video in the blog, I want to exclude the image.
So Video = No image, No video = Image, No video and No image = just the teaser text (which is always present).

What I have tried: Tried the Views Conditional module. Doesn't work since the replacement variable (example [photo]) does not contain the image itself.

Tried Views If Empty module. The logic works but messes up my CSS in a lot of ways and impossible to make it look like it should.

Solution?: I think that what I need is a PHP part in my View.
I have no experience at all with making this. What I have tried is visible below.
(messes up the homepage).

if (empty($fields[$row->field_alg_video_1]->last_render)) {
          $this->last_render = $fields[$row->field_alb_fotos]->last_render;
        }
        else {
          $this->last_render = '';
        }

I just threw some stuff together from the net. Can anyone help me out? :)


texts: Pass offset and limit in Drupal embed view

texts:
I am having below code to embed a view

$view=views_get_view('questions');
$view->set_display('block');

// execute view
$view->execute();
$viewArray = $view->result;

How do I set an offset in this? So that I can get the content I need?

I will be displaying a set of content in a page after processing it. I will need to skip first contents sometime. Like skip first 1 sometime or first 3 some other time.


texts: Register for an event and create an account on one page

texts:
It's been a while since I've used Drupal and I now need to implement the following but can't seem to determine how. I have a site that's set up for event registration and need visitors to be able to sign up for an account as part of that one-page process. They'll then need to be able to edit their registration details and such but that part is in hand. What I'm not seeing is a way to combine account creation with the submission of non-profile form data all in one go.

Any pointers would be greatly appreciated.


texts:
I need to use Drupal as client for a web service, for extracting data and showing it in a view or as content. (The format use is JSON or REST.)

I use a Web Service Client module in Drupal 7, and the Services module in Drupal 6, but I don't know how to use them. I read the documentation but I don't get any result.

Can anyone help on this issue, or tell me how to use these modules? Is there any other module for this purpose?

A possible solution: I find a module called XML VIEWS but this module convert only XML files.

Now, I programing in this module for convert the JSON to XML.

In this files: xml_views_plugin_query_xml.inc

In this function: Execute

Anyone have another solution?


texts: Why is form submit handler not called when calling form_set_error?

texts:
I want to know where in Drupal documentation it is listed that submit handlers are not called when form_set_error has been called.

I don't see it in form_ser_error api, nor in FAPI Quickstart guide and FAPI reference.

Looks like I'm missing some simple thing.


texts: translate interface search exact keyword

texts:
Is there a way in drupal 7 translate interface to search for exact keyword?
The problem is that when I search for keyword 'no' it gives me 19 pages of results.


texts: How do I show the latest poll user hasn't voted on, yet?

texts:
When an authenticated user has voted on a poll, I would like to show the next poll where the user hasn't voted on.

How should I implement that?


texts: Force drupal 7 to place "www" in front of urls

texts: there is a problem when a use logs in after typing "domain.com", clicks on a internal link that leads to "www.domain.com/somthing" and they are no longer logged in until they navigate to "domain.com" again. I just want the system to force the url to add the www at the beginning.


texts: How to add a send email action link in views using the same VBO send email action

texts: Views Bulk Operations (VBO) has a send email action that sends you to an email form. How can I add a views field to a list of users that creates a link to the same action form that VBO uses to send email, but for just that user row and then pre-populate the recipient field? I believe VBO uses the system_send_email_action_form.


texts: How to add fields to a form from a custom module

texts:
I'm working on a custom module that will allow payments through a particular bank API.

The API requires me to do a POST to a certain URL that they have provided me, where the user will enter his credit card information.
To do so, I created a form with the #action set toward the provided URL, and with the mandatory fields asked by the bank (name, address, phone, etc.)

Unfortunatly, the form is in the module, and I don't think that is good practice, since it gets more complicated for a user to add his own custom field (lets say a date of birth for example).

Is there anyway that my module can get a form created by the form API in another module ("my_custom_cart") and add to it the mandatory fields needed for the transaction?

Thank you


texts: How to edit Media module`s display profiles?

texts:
I can`t find where can i edit media module profiles.
There are no any link in admin section.


texts: Display different account fields for my account vs public account

texts:
How can display/hide some fields when viewing an account that isn't the current user vs. is the current user (e.g. the users/steve vs /user)?

I want to have a public profile that shows most of the same fields but hides a few fields that only the 'current' user can see.


texts: Created flag for "add friend", set a View, works but there's a problem

texts:
Ok, so now when a user looks at HIS profile, he gets the links to HIS list of friends, great!
However, when the same user looks at someone else's profile, he sees the links and they point to THAT user's friends - and I don't want that...

I'd like the 'friends' link to only appear if I'm seeing my own profile page; when looking at someone else's profile I shouldn't be able to see THEIR list of friends.


texts: Getting first the terms starting with the string I am searching for

texts:
I am using Drupal 7. I add one vocabulary in taxonomy and I am using it as auto-complete in user's registration.

Now I have a problem with how it search.

When I enter y, it shows taxonomy terms containing y, but I wanted to first see the terms that start with y.

There is module to set this settings, but this module doesn't support Drupal 7.

How can get first the terms starting with the string I am searching?


texts: How to get a dynamic Google map with filtered views and show a marker related to the selected item?

texts:
I plan to create a real estate agency website. In the front page, users can select the type of contract and specific other things to get a list of all the nodes that fit those criteria. So the result is a view (filtered).

I want to get a Google map with marker related to this result. This is possible, but the thing that I can't do is this: when I select an item from this filtered view (with a checkbox for example) I want to recalculate the Google map with only this or those items selected.

About the modules I'm using: in fact until now I use nothing, this is why I post the question, to know if a module (such gmap or simple Google Maps) is better for doing such kind of stuff.


texts: how to specify the file directory in drush config:status

texts:
drush config:import has the --source flag to specify where the import should come from.
drush config:export has the --destination flag to specify where the import should go.
I am trying to automate a system for determining if update hooks have modified configuration, to avoid the problem documented in #3110362 If an update hook modifies configuration, then old configuration is imported, the changes made by the update hook are forever lost.
To do so I will export the config to a temporary directory, like:
drush config:export --destination=/tmp/check-issue-3110362

Then I will run the updates
drush updb -y

Then I want to run a diff between the database config and the config in /tmp/check-issue-3110362, but the following does not work:
drush config:status --source=/tmp/check-issue-3110362
# The "--source" option does not exist.
drush config:status --destination=/tmp/check-issue-3110362
# The "--destination" option does not exist.

How can I tell drush config:status to use a specific directory to check against the database?
My version of Drush is 10.3.6


texts: Is it possible to include a forward slash in a route dynamic property?

texts:
Is it possible to include forward slashes in routing parameters?

// routing.yml
mymodule.route
    path: '/mymodule/{param}'
    defaults:
        path: ''
    requirements
        path: '[A-Za-z0-9\-\/]+'

/mymodule/this/is/a/single/param would then result in

$param = 'this/is/a/single/param';

being passed into the controller method.


texts: Optional field in admin panel to filter nodes in view

texts:
Is there a way to add a optional field that filters nodes in a view?

I'm fairly new to drupal but I have a view that renders nodes depending on their categories. I can edit the view and manually add the filter but that affects all the nodes with that view. So is there a way to add filed to the "edit" screen of a page so I can have a field, that when filled it will filter the nodes it picks up and when it is empty it shows all the nodes?

Sorry if I'm using the wrong vocabulary, really new to Drupal


texts:
Trying to setup the latest jquery update dev version, needed for the installation of the amazing social_count mobile-friendly count widget, I can't configure the module. When logging as user #1 and going to http://www.example.com/admin/config/development/jquery_update,
all I get is access denied. I tried 'drush cc all' to clear the cache but in vain. Any ideas?


texts: How to list terms according to another field

texts:
I have two field(Entity references).  Category and feature fields.
Entity references belong to  different vocabularies.

I need to get child field terms from multiple parent field terms .
My scenario is ; Field A : Category(parent), Field B : Features(Child).
Need to get all features from multiple categories which selected from parent field..

How to filter the options from feature field according to a previous select list (Category field) ?

What I've tried to solve

1-Conditional fields module.
I have to create more 15 fields to assign dependencies for each category. I do not want to use this option as there will be a performance problem.

2-Business rules module
I've tried business rules >> Dependent field with entity refenrence list option.

But It's useful only single parent selected.It shows only child terms (features) from first selected parent(category). I can't get features which belong to other categories.  I need to list multiple features from multiple parent terms selected.

Any help you can give would be greatly appreciated.
Thanks


texts: Custom form: How to implement a module's field widget

texts:
In my custom form I have a file upload, which follows the array structure of file_element_info() in file.module in core. This is consistent with examples in examples module and date module has _date_api_element_info().

But looking at geofield or at openlayers and other modules I can not see what array values are possible/required.

As a general rule how do I find out how to add a field of a specific type to a custom form?

Edit #1:
Just read Where can I find complete documentation of hook_field_info? and everyone is being really helpful about Field API, but it is a steep learning curve. A specific example would really help (an not one of the simple core field types).

Edit #2:
So on my particular example in geofield.module I got (got the same using dpm(field_info_field_types('geofield'));):

function geofield_field_info() {
  return array(
    'geofield' => array(
      'label' => 'Geofield',
      'description' => t('This field stores geo information.'),
      'default_widget' => 'geofield_wkt',
      'default_formatter' => 'geofield_wkt',
      'instance_settings' => array(
        'local_solr' => array(
          'enabled' => FALSE,
          'lat_field' => 'lat',
          'lng_field' => 'lng',
        ),
      ),
      'property_type' => 'geofield',
      'property_callbacks' => array('geofield_property_info_callback'),
    ),
  );
}

But how does that translate to a form field array?

$form['location'] = array(
    '#title' => t('Location'),
    '#type' => 'geofield',
    '#required' => TRUE,
);

Or do I have the wrong end of the stick here?


texts: Set vertical/horizontal image same height in carousel

texts:
I'm using Owl Carousel to display images, but I don't know how to set horizontal pictures same height as vertical pictures without screwing up the whole carousel.

This is the page: link

I've tried to set .owl-item to width:auto but that will only cut the carousel at the end. It will stop at a certain point and won't let me see the other images.

HTML:


texts: how to Create some nodes of a content type when created a node of another content type?

texts:
I would like to create an editable task table with slickgrid view, where each row is a node (of content type 2) that will be created automatically by a different content type (the 1st content type) or a webform.

Content type 1 - The 1st content type have 4 fields (this node will create automatically some nodes of the second content type)

1st - "Days" - is a Date field type - with unlimited (1 to 10) values

2nd - "City's" - is a Reference to a Term - with unlimited (1 to 10) values

3th - "Type of operation" is a Reference to a Term - with an unique value

4th - "Number of person by city" is a Integer field type - with an unique value

Content type 2 - the 2nd content type have those fields

1st - "Day" - is a Date field type - with an unique value

2nd - "City" - is a Reference to a Term - with an unique value

3th - "Type of operation" is a Reference to a Term - with an unique value

4th - "Name of a person" is a text field - with an unique value

Now for example if i create a node of Content type 1 with 5 values for the date field and 5 for the City's and the number "2" for the integer field, it will create automatically 5*5*2= 50 nodes of Content type 2, the "name of a person" field will be created empty of course.

I think i must create a module or perhaps with rules it's possible ? is it possible to replace the content type 1 by a webform? I'm newbie in drupal module developement. Thanks.


texts: How do I remove the active class in the main menu?

texts:
One item in the menu has sub-items that point to the same page (just with different arguments) ex:

Products
- List item 1  \products?pid=1
- List item 2  \products?pid=2
- List item 3  \products?pid=3

Drupal assigns the "active" class in the  and  tag of the menu items since all the items have the same page url (\products)

I'm overwriting the menu_link function in template.php to remove the active class but the class remains in the  tag

function mytheme_menu_link(array $variables) {
  $element = $variables['element'];
  $sub_menu = '';

  if ($element['#below']) {

    if (strtolower($element['#title']) == 'Products') {

      if (isset($_GET['pid'])) {
        $currID = $_GET['pid'];

        foreach ($element['#below'] as $Taxonomy) {

          if ($currTaxonomyID != $Taxonomy['#localized_options']['query']['pid']) {
            $mlid = $Taxonomy['#original_link']['mlid'];
            $key = array_search('active', $Taxonomy['#attributes']['class'], TRUE);
            if ($key) {
              unset($element['#below'][$mlid]['#attributes']['class'][$key]);
              $element['#below'][$mlid]['#localized_options']['attributes']['class'][$key] = '';
            }
            // remove active-trail class
            $key = array_search('active-trail', $Taxonomy['#attributes']['class'], TRUE);
            if ($key) {
              $element['#below'][$mlid]['#attributes']['class'][$key] = '';
            }
          }
        }
      }
    }
    $sub_menu = drupal_render($element['#below']);
  }
  $output = l($element['#title'], $element['#href'], $element['#localized_options']);
  return '
' . $output . $sub_menu . "
\n";
}

Final Result:

      Best Practices

      Checklists

....

How can I remove the class "active" from the  tag?

My menu Structure:

-Clients
-Products
  -prod1 (url:\\products?pid=1)
  -prod2 (url:\\products?pid=2)
  -prod3 (url:\\products?pid=3)
  -prod4 (url:\\products?pid=4)
-About


texts: Is there a way to programmatically alter a field's schema?

texts: Is there a way to modify a fields schema programmatically? I'd like the image field to have a "Premium" checkbox, but I need to store this data somewhere. Also, it needs to work for current fields and future fields as they are created.


texts: Is there any way I can use having clause with EntityFieldQuery? I want to get the nodes which have same field value similar to HAVING clause in SQL. Or do I need to do other ways? Please suggest if there is any good way to do this.


texts: Populating a node reference field using PHP in Rules

texts:
I have a rule which is triggered when a node is flagged. Currently, the rule loads some content (1) that has been referenced by a field on the flagged content. I have set the rule to create a new piece of content (2) and would like a node reference field on this new piece of content to reference content (1). I know there is a way to do this with PHP but am not sure of it...

Got one more...

I'm now trying to use rules to populate a select list field on a new piece of content. I need the value of the field to be the same as a piece of referenced content that's available to rules. Usually I would use tokens but as its a select list field there is nowhere for me to insert a token. I'm thinking some PHP would do the job, but I don't know where to start.


texts:
I have a content type called project, and also have a filefield there. I am supposed to allow users to rename the file. For this purpose, I've tried implementing hook_form_FORM_ID_alter and using $form['group_file'] = array('#type' => 'fieldset', '#title' => 'Foo'); just to test, but nothing changed. Should it not fail, I will also place a button to rename the file. Below is my code. What am I missing or doing wrong? My fieldset is called group_file (at least that's what devel tells me)

function unsw_form_project_node_form_alter(&$form, &$form_state, $form_id) {
  $form['group_file'] = array(
    '#type' => 'fieldset',
    '#title' => t('Rename'),
  );
}

Here is the screenshot from content type settings


texts: Views using an incorrect column name in my join statement

texts:
I have an Entity with an entity reference to another Entity. The field is defined as:

$fields['sample'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('Analysis Samples'))
  ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
  ->setSettings(array(
    'target_type' => 'sample',
  ))
  ->setDescription(t('Samples for Analysis.'))
  ->setDefaultValue('')
  ->setDisplayOptions('view', array(
    'label' => 'above',
    'type' => 'string',
    'weight' => -4,
  ))
  ->setDisplayOptions('form', array(
    'label' => 'above',
    'type' => 'entity_reference_autocomplete',
    'weight' => -4,
  ))
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE)
  ->setRequired(FALSE);

In the database, this created a new table that looks like this:

mysql> describe fermentor__sample;
+------------------+------------------+------+-----+---------+-------+
| Field            | Type             | Null | Key | Default | Extra |
+------------------+------------------+------+-----+---------+-------+
| bundle           | varchar(128)     | NO   | MUL |         |       |
| deleted          | tinyint(4)       | NO   | PRI | 0       |       |
| entity_id        | int(10) unsigned | NO   | PRI | NULL    |       |
| revision_id      | int(10) unsigned | NO   | MUL | NULL    |       |
| langcode         | varchar(32)      | NO   | PRI |         |       |
| delta            | int(10) unsigned | NO   | PRI | NULL    |       |
| sample_target_id | int(10) unsigned | NO   | MUL | NULL    |       |
+------------------+------------------+------+-----+---------+-------+
7 rows in set (0.08 sec)

When I make a view, and try to set a relationship between Fermentor and Sample, it tries to join on a column called fermentor__sample.sample instead of fermentor__sample.sample_target_id:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'fermentor__sample.sample' in 'on clause': SELECT fermentor.id AS id, sample_fermentor__sample.id AS sample_fermentor__sample_id FROM {fermentor} fermentor LEFT JOIN {fermentor__sample} fermentor__sample ON fermentor.id = fermentor__sample.entity_id AND fermentor__sample.deleted = :views_join_condition_0 INNER JOIN {sample} sample_fermentor__sample ON fermentor__sample.sample = sample_fermentor__sample.id; Array ( [:views_join_condition_0] => 0 )

Is this a bug in Views, or do I need to specify the correct join column in my Entity's ViewsData Object?