texts:
I can't change 'Add to cart' button value (site http://zoo812.ru)

Now it is value="Добавить в корзину", I want to change it to value="buy"

I inserted

function ivanco_form_commerce_cart_add_to_cart_form_alter(&$form, &$form_state, $form_id) {
    $form['submit']['#value'] == t('Buy');
}

in template.php, but it does absolutely nothing.

String overrides also doesn't work.

There is no js code linked with it nor any other mentions about it in theme files.

You see, there is Catalog View, and each item's displayed with Evo.

I can do this with JS of course, but it wont be elegant..


texts: How can I have multiple caches of the same page with different query arguments?

texts:
Using Drupal 8, I have a page (a node) that has two different renderings depending on a passed in query parameter. This is to support a regular page view in a browser and also an embedded version of the page without the header, footer, etc. Example:

https://www.domain.com/my-page
https://www.domain.com/my-page?version=embedded_view

I've implemented this by using THEME_theme_suggestions_page_alter() in my .theme file to suggest a different page template to use depending on the query parameter. (Perhaps there's a better way.)

When viewed on a site with caching enabled, both of the URLs return the same rendering of the page. How do I get different cached versions for the two URLs?


texts: Change a normal submit 'input' type to 'button' type with button tag

texts:
Is it possible in Drupal 8 to change a regular form submit button from Drupal into a button tag?

This is the output I need to achieve:

<button type="button" class="search-box__button">
  <svg class="icon search-box__open">
    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/build/img/svg-sprite.svg#icon-search"></use>
  </svg>
</button>


texts: Module submission guideline - configuration storage

texts:
I am trying to finish and submit my first module project. It's a QA/tab launcher thing that is meant for multisites. Basically, I am using a few different methods to retrieve a list of sites that are part of the same multisite as the site that the module is enabled on. The piece I have a question about is a configuration page that saves a list, from that list, of "enabled" sites.

Here is my problem: I want a multisite-wide configuration, but I am concerned about how i'm doing it. I understand that the Domain Access module would provide more than enough functionality for cross-site database access and would probably be more up to the Drupal guidelines, but it's extremely overkill! Domain Access will scare off people that don't want to configure each settings.php file, etc.

All I need, literally, is to save 2 non-associative arrays in a way that each multisite has access. My current setup saves them in the public files directory as 2 .csv files, and works as well as I know how to code it; as far as saving .csv's and retrieving the rows go, I think i'm doing it right. It doesn't really have performance issues tied to it because it truly is a lightweight piece; the only reason i'm doing it this way is for global access.

My question is: is this going to get flagged as non-conformant to the Drupal way because i'm not saving it in a table? I don't see anything in the guides specifically guiding me away from doing it that way... but it's just a guess that they won't like it.


texts:
Just that. Can I create a node, assign a language and provide it  a menu link with Drush?

Let say, I want to create a node:

of the basic content type
with title set to "my title"
set to es language
and provide it  a menu link in the Main menu


texts: Render chart with data from Views PHP custom field

texts:
How to render a Column Chart using data from Views PHP custom field (BAR Number (PHP custom) in the screenshot below)?

I am trying to achieve a Column Chart; with each bar in the chart being distinct count number of "bar number".

I have tried using aggregation (with charts module chart add-on enabled), but does not give option to aggregate/count on PHP custom fields.
have tried Google Chart Tools module, but again it does not consider PHP Views custom fields for Grouping.

Just for more information on what I am trying to achieve, please refer below Requirement screenshot!

Thanks in advance!


texts: It is possible to pass and argument to a view for the limit on its pager? I see that there is this question for Drupal 7, but not Drupal 8.


texts: How can I combine a product attribute with a subset of another one in Drupal Commerce?

texts:
Assume I have 2 product attributes (using the Drupal Commerce module):

Background color (white, black, green, blue, yellow).
Surface (glossy or matte).

And assume that surface "glossy" can be only selected in combination with background color "white" or "black".

How should I configure this conbination of attributes?


texts:
I have multisite DRUPAL6.26 website using VIEWS 3.0 module in it.

Both sites are install in single DB.
The first/parent site has no prefix for its tables.EX: node,block,role etc..
The second/childsite has prefix of child. EX: child_node,child_block,child_role etc..

I have a VIEW showing all pictures uploaded by user in there PARENT site account.
And the same VIEW for CHILD site showing pictures that they upload on CHILD site.

What I want is to show all pictures in PARENT site account of user whether they upload on PARENT site OR CHILD site.
[users are shared between the 2 sites.]

Any help of 'views master' required :)


texts: Call User Profile Field in Node Template

texts:
I have a field in my user profile of byline (field_byline). I'd like to call this in the node template so that the byline is included next to the author's name (e.g. Posted by Mr. Rogers | Sweater Entrepreneur) I kind of have it working, but not quite there yet. I'm using Drupal 7.10

Right now, I have this in my template.php

global $user;
  $user = user_load($user->uid);
  $bylines = field_get_items('user', $user, 'field_byline');
  if ($bylines) {
    $vars['field_byline'] = $bylines[0]['value'];
  }

}

And this in my node.tpl.php

if (isset($field_byline) && !empty($field_byline)) :
  echo '| ' . $field_byline.'';
endif;

But, my problem is this only calls the correct byline while viewing the individual node. It breaks on the front page when all the nodes are looped out and only displays the byline of the first user, not the one that wrote the post.

Any help or direction would be much appreciated!


texts:
I have a Drupal 8 website with an application form built with Webform. I would like to be able to auto create a user when the webform is submitted using details from the webform, so the person filling in the application can log-in and check the status of their application. I've seen several options online but all are for Drupal 7 and the modules used are not available for Drupal 8.

Any ideas?


texts: Adding a view in the Paragraphs Selector

texts:
I have a drupal 9 website where I created a View "Homepage - article overview".
On the homepage I have paragraphs enabled (text/image | 2 columns | 4 columns | Full width image).
I want to be able to show that view I created as being on of the paragraphs.
So I can always determine the order of the different pieces.
Is there a module that can tackle this, or do I need to dive in the code?


texts:
I am following https://www.drupal.org/node/1438206, but i got stuck at Point 2. i.e Add the bin directory of postgres, /Library/PostgreSQL/8.4/bin to the PATH in your .bashrc file in your home directory. Remember to run ./.bashrc to update the path.

I installed postgreSQL using brew. Now i do not find /Library/PostgreSQL/*/bin path i.e I do not find PostgreSQL inside Library.
Also i do not find .bashrc file .

I have installed postgreSQL for sure.Please help me out.


texts:
In Drupal 7 we were able to use field_attach_update($entity_type, $entity) to update fields without having the need to update the whole node. $node->save() is very heavy and calls many hooks in between.

With the coming of Drupal 8, field_attach_update was deprecated. Is there an alternative to it, and what is it if yes?

In my case I'm updating two image fields programatically and don't want to call $node->save in order to not trigger all the other hooks.


texts: Classes with the same name and description, but different location

texts:
When I am looking for an information about any class in api documentation, I often encounter the situation when there are several classes with the same name and the same description, but different location.

For example, there are two classes with name YamlDiscovery and the same description.

How should one select a needed class for oneself? Can use any class? If so, what for they were added both into Drupal 8?


texts:
I am making a nav bar using the suckerfish module. I have installed the suckerfish module and have extracted the library into the necessary folders. I'd like to change the width of the individual columns in the nav, as some of my menu items are getting cut off. I'd also like to change the width of the nav bar as a whole, as it is not the same width as my header. However, when I try to make basic edits in the space-orange.css file, the edits do not seem to make any difference what-so-ever. I can change the style of the nav bar from the blocks menu, so I know the css files are in the right place. I have also looked at the suckerfish.css file, but it's not clear what, if anything, I could try to edit there. I am all out of ideas at this point. Are there any great tutorials out there pertaining to this? I can't seem to find any. Any help in getting me going in the right direction would be most useful and appreciated.

Thanks,

Kev


texts: Core Drupal8 JS necessary for Drupal theme to function

texts:
I have recently noticed that Drupal8 is adding number of JavaScript files. I would like to know if it is necessary for theme to function

<script src="/core/assets/vendor/domready/ready.min.js?v=1.0.8"></script>
<script src="/core/assets/vendor/jquery/jquery.min.js?v=2.2.4"></script>
<script src="/core/misc/drupalSettingsLoader.js?v=8.3.7"></script>
<script src="/core/misc/drupal.js?v=8.3.7"></script>
<script src="/core/misc/drupal.init.js?v=8.3.7"></script>

My theme does not use any of them. I would like them to be removed. Can anyone here tell me how to remove them?


texts: How can I create a view, where all profile fields are as columns of a table view, without having to add each profile field indivudally? Is this possible?


texts: URL-dependent templates only evaluated once, incorrectly cached

texts:
I have a twig template that controls the HTML of the page based off of some URL-specific information. However, this template seems to be evaluated once on the server and then gets cached, never to be evaluated again. The result is that the first page loaded displays the correct information inside this particular block, but every page after that displays the same information as the first page in the block, even though the URLs are obviously different.
To illustrate, page A should have data A loaded on the side in a block, page B should have data B loaded on the side, and so on. If you go to page B first, then you will see data B loaded correctly. However, after that, if you go to page A, you will still see data B loaded on the side, rather than data A. Note that this bug only pertains to the portion of the page that is controlled by the URL-specific logic; the rest of each page loads correctly.
If I go to Home >> Administration >> Configuration >> Development and clear the cache, the next page loads correctly, but then I'm just stuck with a new incorrectly cached chunk of data for all the other pages.
Why is Drupal caching this block whose display is dependent on the URL? More importantly, how can I get rid of this behavior without disabling caching completely?
Update 1: I have tried going to the view for the block (Home >> Administration >> Structure >> Views) and under Advanced Settings selecting None for Caching, but this has no effect.
Update 2: I don't have a custom block with code to modify, so not sure how to incorporate fixes from questions like this.


texts: How do I query for content that has not been updated (no revisions)?

texts:
I am creating an API endpoint that serves as a content Feed that pulls in content according to some rules.

One group of content that I want to pull is articles that have been updated and that have been approved to be included in the feed. My approach for this was to include a boolean field for including it in the feed, and query for the number of revisions.

$firstGroup = $query->andConditionGroup()
    ->condition('type', ['article', 'video_game'], 'IN')
    ->condition('status', NodeInterface::PUBLISHED)
    ->condition('field_include_in_feed', 1)
    ->condition('revision_uid', '1', '>=');

$nids = $query->condition($firstGroup)->condition($secondGroup)->execute();

Based on this page from the documentation, I thought revision_uid would be a valid field, but I get an error that it is not. Likewise I get an error, if I use revision as well.

The error is a Drupal QueryException with the message 'revision_uid' not found.

What is the best way to query for content (with entityQuery) that has been updated if I can't use the revision fields?


texts: Programmatically create a block region in Drupal 7

texts:
I am stuck with programmatically creating of regions in Drupal 7. I know how to create regions in .info file, but my problem is that I want regions for every node I create, to show a specific block to each and every node differently.

I am interested in Drupal 7 only. If it is possible by creating a module, that is a solution that interests me, too.


texts: Saving a value from Javascript on Drupal form submit

texts:
I have a jQuery map that I've built that allows users to select states and counties. This is all done in Javascript. I would like to, on form submit, take this data and submit it to the user's profile2.

Should I create an empty form element and fill it somehow? It seems like there wouldn't be a way to pass any information to a form that happened after page creation.


texts: How to show the slide dots using the Slick Carousel module?

texts:
I'm using the Slick Carousel module and I can't see where / how to add the paging dots below the carousel images. The module boasts that it has this feature.

I've tried altering the .js file (and the .min version) but can't seem to force them to show.

Does anyone know where to turn this on?


texts: db_fetch_array() fetches only one row from data table, even though I am expecting multiple results

texts:
I'm trying to create an array with all the group node' IDs, and from outside group context.
I currently have two group nodes defined, and I can see them in my OG table.

However I only get back one result, using the following code. I've tried using only db_query() without db_fetch_array() and I still get a single result.

$group_node_nids = db_fetch_array(db_query("SELECT nid from {og}"));

What am I missing here?


texts: How can I repeat parent table field only once for a group of child table fields?

texts:
I am using Drupal Views module. I have Student accounts table that can have multiple students in it. Is there a way to create a table like the following?

╔════╦═════════════╦═════════════╦═══════╦═════╗
║ id ║ Title       ║ Student Name║ Gender║ age ║
╠════╬═════════════╬═════════════╬═══════╬═════╣
║ 1  ║ Acount 1    ║ Jack        ║ Male  ║ 50  ║
║    ║             ╠═════════════╬═══════╬═════╣
║    ║             ║ Smith       ║ Male  ║ 33  ║
╠════╬═════════════╬═════════════╬═══════╬═════╣
║ 2  ║ Acount 2    ║ Ellis       ║Female ║ 42  ║
║    ║             ╠═════════════╬═══════╬═════╣
║    ║             ║ Joe         ║ Male  ║ 43  ║
╚════╩═════════════╩═════════════╩═══════╩═════╝

My current table shows the data like this:

╔════╦═════════════╦═════════════╦═══════╦═════╗
║ id ║ Title       ║ Student Name║ Gender║ age ║
╠════╬═════════════╬═════════════╬═══════╬═════╣
║ 1  ║ Acount 1    ║ Jack        ║ Male  ║ 50  ║
║════║═════════════╠═════════════╬═══════╬═════╣
║ 1  ║ Acount 1    ║ Smith       ║ Male  ║ 33  ║
╠════╬═════════════╬═════════════╬═══════╬═════╣
║ 2  ║ Acount 2    ║ Ellis       ║Female ║ 42  ║
║════║═════════════╠═════════════╬═══════╬═════╣
║ 2  ║ Acount 2    ║ Joe         ║ Male  ║ 43  ║
╚════╩═════════════╩═════════════╩═══════╩═════╝

I want to avoid the repeat of of id and title columns.
Any idea how to do this?

This is the setting for my view:


texts: How to make sure the footer is always at the bottom?

texts:
As an important note I do NOT mean position: fixed;!!!

When the body is smaller and does not take the full height of the browser size, the footer just likes to chill in the middle of the page. If you look in the photo I shared you can see more clearly what I mean. I've tried things like body{height: 100%;} to no avail. Even attempted this: https://css-tricks.com/snippets/css/sticky-footer/ and it seemed to just break it more (especially on the front page where this isn't a problem. Is there possibly a way to make sure the body size is at least the size of the browser always?


texts:
I would like to know the recommended way to re-theme the default node view for a certain content type.

E.g. http://dev.mysite/en/node/6547, now shows a 'list' of content fields. We would like to change this to a more clean layout.

Would using a node.tpl.php in the theme folder and then create a node--[TYPE].tpl.php for the specific node type solve this problem in the correct way?

Regards,
Wouter


texts: How to improve the clarity of hierarchical taxonomy terms in edit forms?

texts:
I have a hierarchical taxonomy vocab. When I go to -say- a node edit form that uses this, with checkboxes, the hierarchy is represented simply by prepending a - for every level of depth. This really does not represent the hierarchy very well - it's hard to see, and ideally it would be semantic (nested list), or at least add a class on the container elements like taxonomy-level-N.

Is there a module for this? Or some other hack?


texts: Views exposed sort handler with asc + desc + inactive

texts:
I have a view with the following sort handlers:

price (exposed, asc/desc, default=asc)
stock (desc)

I would like to have a third option for price so that it can be inactive/asc/desc, with "inactive" being the default.

So by default it sorts by stock availability (or any other sort handlers I may configure in the future), and only if the user chooses "cheapest first" it will sort by price.

(I am going to use Better exposed filters to display the sort options as links, but this is secondary)


texts: Field Collection Node Clone for translating nodes?

texts: I have a website with lots of field collections. When cloning a node, this module helps clone field collections as well, so that they don't reference the same collection. Is there anything similar for when translating nodes with i18n? This could be a big problem for me if not!


texts: Drush needs a higher bootstrap level to run

texts:
Do you have any idea on what might be causing this error when I execute:

drush si geoslate --db-url='mysql://root:root@localhost/geoslate' --site-name=Geoslate

  Command site-install needs a higher bootstrap level to run - you will need to invoke  from a more functional Drupal environment to run this command.
  The drush command 'si vimn_geoslate' could not be executed.
  A Drupal installation directory could not be found

?


texts: Is drush required on the remote server to do sql-sync or rsync operations?

texts:
I am working my way through the Drush chapter in Definitive Guide to Drupal 7 by Apress. I want to sync the mysql database and files to/from my local MAMP developer stack and the remote live server (shared hosting).

Given that the drush rync commands deal with the files and the database, then surely it is not necessary to have to have drush on the remote server? If it has to be on the remote server the I accept that but please explain why. I do appreciate that other drush operations would require it e.g. core-status though but the aforementioned operations I am doing involve just the drupal code and database not anything to do with drush.

Please advise, guides don't state everything and make assumptions sometimes.


texts: E-mail notifications to specific user roles based on events in calendar

texts:
I'm looking for a way/module to send an e-mail notification to users if an event is added to a calendar. Also a weekly reminder of the upcoming events that will take place next week. I'm not sure if this is possible with the Rules module or is this something I should do with cron?

Drupal version: 8.6.7


texts: Custom field validation condition not working

texts:
I have created a custom form validation.

I am using webform module to build the form.

in _achva_tz_validate function there are two fields that have the same validation.

The second field, zug_id, is shown only if the user selects family_state  value to 1. if family_state is not 1 the zug_id field is hidden.

The issue is that the zug_id validation is not fired.

I am looking for a way to fire it only if
$form_state->getValue('family_state') === 1

this is the module_name.module code:

// DEFINE TZ RETURN VALUES
define(TZ_ELEGAL_INPUT, -1);
define(TZ_NOT_VALID, -2);
define(TZ_VALID, 1);

function ValidateID($str)
{

    //Convert to string, in case numeric input
    $IDnum = strval($str);

    //validate correct input
    if(! ctype_digit($IDnum)) // is it all digits
        return TZ_ELEGAL_INPUT;
    if((strlen($IDnum)>9) || (strlen($IDnum)<5))
        return TZ_ELEGAL_INPUT;

    //If the input length less then 9 and bigger then 5 add leading 0
    while(strlen($IDnum<9))
    {
    $IDnum = '0'. $IDnum;
}

    $mone = 0;
    //Validate the ID number
    for($i=0; $i<9; $i++)
    {
        $char = mb_substr($IDnum, $i, 1);
        $incNum = intval($char);
        $incNum*=($i%2)+1;
        if($incNum > 9)
            $incNum-=9;
        $mone+= $incNum;
    }

    if($mone%10==0)
        return TZ_VALID;
    else
        return TZ_NOT_VALID;

}

function achva_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)
{
    switch($form_id){
    case 'webform_submission_qyt_qlyth_mwrwt_mmnwt_wqdmyh_kyt_add_form':
        $form['#validate'][] = '_achva_tz_validate';
        break;
    default:
        $form['#validate'][] = '_achva_tz_test_validate';
        break;
    }
}

function _achva_tz_test_validate(&$form, $form_state) {

    if(ValidateID($form_state->getValue('idno')) !== 1) {
        $form_state->setErrorByName('title', t('Please enter a valid ids number'));
    }
}

function _achva_tz_validate(&$form, $form_state) {

if(ValidateID($form_state->getValue('idno')) !== 1) {
    $form_state->setErrorByName('idtitle', t('Please enter a valid id number'));
}

if(ValidateID($form_state->getValue('zug_id')) !== 1 && $form_state->getValue('family_state') === 1) {
    $form_state->setErrorByName('zugidtitle', t('Please enter a valid zug id number'));
     }
  }


texts: Getting latest node to display as front page

texts:
I have what seems like a simple question about something it seems like many Drupal users would want to do, yet I cannot seem to find a good answer. I want my latest node (preferably of a single content type) to show as the front page. If I add a node, I want it to automatically become the front page. I don't want the front page to list nodes, etc. I found the "Top Node" module, which offers a view called "Single Node", which seems to do exactly what I want, but it has some problems (notably that it breaks the <front> alias used in setting block displays). There must be some way to do something that seems to be so common without an additional module, right?

I am aware that I could create a view that pulls the content from my latest node and creates a new page for it, but that seems like overkill, since the node already exists. Also, some of my node is being created programatically, and I cannot get those parts of the full node using a view.

How can I do this? Is there no built-in way?


texts: Add product thumbnail to user/%/purchased-files?

texts: I've managed to add an extra field in the Purchased Files page, as well as hide the address limit, however I cannot figure out how to actually get the product thumbnail in there, like there is on the cart page. Below is what I'm working with so far, any ideas how to get the image associated with that file in the empty field?


texts: Views: Return the nodes either side of current node

texts:
Is there a way in views to return 1 node that was published before the current node being viewed and the 1 node after?

Currently I have a view using a contextual filter which is the current NID from URL but I can't find a way to pass that to the filter criteria.

Is it possible? It can be split in to 2 views if needed so in 1 I get the previous node and the other I get the next one.

e.g.

current nid = 2

View returns 1, 3


texts: No orders in user profile with custom state of order-status

texts:
Drupal 6 + Ubercart. I had created some new order statuses with own state. But when order gets this status, order dissapears from user "Ordered products" (in user's profile)

How to fix this?


texts:
I wanted to see if there is a way to change a user role using drush. I found this post explaining how to do it but I get an error. I replaced the actual username with "USERNAME".

drush user-add-role administrator USERNAME

> exception 'Drush\Role\RoleException' with message 'Could not find the
> role:      [error] administrator' in
> /usr/local/src/drush/lib/Drush/Role/RoleBase.php:46 Stack trace:
> #0 [internal function]: Drush\Role\RoleBase->__construct('administrator')
> #1 /usr/local/src/drush/includes/drush.inc(113): ReflectionClass->newInstanceArgs(Array)
> #2 /usr/local/src/drush/commands/core/role.drush.inc(273): drush_get_class('Drush\\Role\\Role', Array)
> #3 /usr/local/src/drush/commands/user/user.drush.inc(281): drush_role_get_class('administrator')
> #4 [internal function]: drush_user_add_role('administrator', 'USERNAME')
> #5 /usr/local/src/drush/includes/command.inc(368): call_user_func_array('drush_user_add_...', Array)
> #6 /usr/local/src/drush/includes/command.inc(219): _drush_invoke_hooks(Array, Array)
> #7 [internal function]: drush_command('administrator', 'USERNAME')
> #8 /usr/local/src/drush/includes/command.inc(187): call_user_func_array('drush_command', Array)
> #9 /usr/local/src/drush/lib/Drush/Boot/BaseBoot.php(62): drush_dispatch(Array)
> #10 /usr/local/src/drush/drush.php(70): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
> #11 /usr/local/src/drush/drush.php(11): drush_main()
> #12 {main}

I am using Drupal Commons 7.50 and Drush 7.0.0.

Edit: Things I have tried:

spelling role correctly and making sure it exists
clearing cache


texts: Wysiwyg profile returns empty input field

texts:
I have the CKEditor Wysiwyg profile assigned to the plain text format. When I want to edit text somewhere in Full HTML, it works. But when I select the plain text, the input field of the text is completely gone.
Here are 2 images to help explain what happens.

First image is normal, second image is when I selected the plain text format and where I would like to see a wysiwyg editor appear.


texts: How to manually create a menu item for a taxonomy term?

texts:
We need to create menu items out of some taxonomy terms in D7.  Currently we do this manually by switching between taxonomy and menu administration pages.  That is, we:

In the vocabulary administration page, create a term.  Set the term's path.
In the menu administration page, create a menu item pointing to the path of the above term.

This can get quite tedious.  There are some ways to automate this but we still want to create menu items manually for the sake of flexibility.  For example, we need to create several menu trees from a single vocabulary.  Also, the terms that would get a menu item are more or less hand-picked in our case, so they may not be easily selected with a view.  Ideally we just need some way to simplify managing the menu item of a term.
It would be great if there is a "menu settings" tab when editing a term, just like the same tab you get when editing a node.  That way we could have a single interface to manage the term and the menu item it created.

I am wondering if there is already a module for this.


texts:
Is there a simple way to check (example: see from UI or browser developer tools) if a rendered View was retrieved from cache or just generated on the page load?

This would need to work for every view display, like a View Content pane embedded in a Panels page.

Would this need custom code or is there a module or any-other-simple-way for this?

Thanks


texts: Does 'aggregate and compress CSS files' actually use gzip?

texts:
Under performance settings in my D7 site, I have "Aggregate and compress CSS files" enabled.

When I run YSlow, I get this:

  Grade F on Compress components with gzip. There are 4 plain text
  components that should be sent compressed:

  /files/css/css_CKoWqiBj9gVXhPuDSnNphuEB0b0J2To76x0pX0EGqn4.css
  /files/css/css_5lmdLBQE3741385dmh2zZ_gO_fPyq-62r9KkuUzfIH0.css
  /files/css/css_UIg6lj2uEi5H1zubqecd1x6N7_ejFWRiwKYJ_qrEmOQ.css
  /files/css/css_oYatxLY13v2flmA_6hUfSrbPmK_x8KS-tOsczLXYqqo.css

This suggests that the aggregated CSS files aren't being gzipped by Drupal?


texts: Custom packaged CKEditor: Make buttons available on profle configuration page

texts:
We wanted buttons to add Definition Lists (dl, dt, dd tags) in CKEditor using this CKEditor plugin ckeditor-plugin-descriptionlist. There is already ckeditor_descriptionlist module but not available for Drupal 7 at the moment.

So, we packaged CKEditor to have descriptionlist plugin in it. Here is that custom built CKEditor package: ckeditor-4.5.11-full-with-descriptionlist.zip.

Problem is that three buttons from descriptionlist plugin is not available in CKEdior profile configuration pages to add to any particular profile.

I know we can backport above mentioned ckeditor_descriptionlist module to work in Drupal 7. But I am asking whether it will be possible to bring that buttons for configuration without using a drupal module as we have CKEditor package with required plugin?


texts:
I have a role called "Secretary" and I would like for the role to be able to access a "view" with a list of usernames and emails. What's the easiest way to do this?

I know how to let only the secretary have access to the page, and I have the views module installed. But I'm not that good with it yet. Any ideas?


texts: Why would one use entityfieldquery over views? Is there any benefit to using EntityFieldQuery over using views? Is it the performance benefit? Is it the ease of use of a API? Does it provide you more granularity?


texts: Logged off users still showing as "Online" on views, but fine on Who's Online module

texts:
I am using a view to show which users of the website are online or offline. I am using user:online field and global PHP field combination with views PHP. Everything works perfectly.

However, when a user logs off, they are shown online forever.

The code I use for global PHP is the following.

<?php print_r ($row->login); ?>


texts: Not getting fieldset as a option while adding new fields in content type

texts:
I am adding new field in content type and I want that field's Field type to be Fieldset but there is no such option in Field type column.

Can anyone know how can I add new field's Field type as Fieldset

Thanks


texts: Converting a page created with panel into PDF

texts: I'm working on D7 Panels and I created few pages using panel. I have a use case to generate the pdf for the data existed in the panel rather than the whole page with header and footer. Are there any recommendations to implement this.


texts:
I want to make a mini panel loaded with the fields of the "Node being viewed".
But I don't know how to make this happen. Any suggestions?


texts: How can I add rows to grouping in views?

texts:
I have a view that lists terms from two different vocabularies (Product Categories, and Traits). The Product Categories vocabulary looks something like this:

Sweet Corn

Type 1
Type 2

Onions

Type 3
Type 4

Popcorn

Type 5
Type 6

Each of these parent categories also have specific traits that are identified in the Traits vocabulary that looks like this:

High Expansion
Augmented
Celebrate

High Expansion is a trait of Popcorn, Augmented is a trait of Sweet Corn, and Celebrate is a trait of Onions. Traits are different from Categories, and must be defined in a separate vocabulary due to other definitions and functionalities on the site. So, I can't just make them children of the above parent terms.

I have a view that is a main landing page for the product categories that displays the icons for all the Categories and Traits, that the user can click to see a filtered view of products within the category clicked. I am grouping the view results by Parent term, but also need to include the Traits in the appropriate groups.

On my landing page view, I need to list the Traits under the appropriate grouping, so my landing page view should look something like:

Sweet Corn

Type 1
Type 2
Augmented

Onions

Type 3
Type 4
Celebrate

Popcorn

Type 5
Type 6
High Expansion

Is there any way to accomplish this type of grouping?

Thank you for your help!


texts: Is it possible to output all taxonomy terms in page--products.html.twig template?

texts:
I am using Drupal 8.7.5. I setup three different taxonomy types. They are Category, Types, and Tags. I have a custom post type called Products.  I created a View called Products and added that as a page in my main menu.  Then i used Devel to fill products with some dummy data.  All of that went very smooth.

Now, I want to output all of the categories, types and tags in my page--products.html.twig file in a select menu or checkboxes to create a filter system.

I've been looking around and I don't see how to get to these values from a page template.  Can anyone offer some clues?


texts:
On the basic page content type, we have a paragraph field that is set to Plain Text with Link field and below are the paragraph type's fields.

How to append a  to the field so that it is displayed right at the end of the field?

Fields:

Description (type = text (formatted, long))
Link (type = link)

Current

Twig template:

{{ content.field_description }}
{{ content.field_link }}

Sample output:

Dramatically create 24/7 paradigms via ubiquitous information.

Read More

Goal

Twig Template:

{{ content.field_description }}

Desired Output:

Dramatically create 24/7 paradigms via ubiquitous information. Read More

What we tried and got stuck. When we tried to print the $pr_description field using ksm(), we could not find a method or array where we could append the link to:

mytheme.theme

function mytheme_preprocess_paragraph__plain_text(&$variables) {
  $pr_plain = $variables['elements']['#paragraph'];
  if(!$pr_plain->get('field_link')->isEmpty()) {
    $pr_link_field = $pr_plain->get('field_link')->first();
    $pr_link_uri = $pr_link_field->uri;
    $pr_link_title = $pr_link_field->title;

    $pr_description = $pr_plain->get('field_description');
    ksm($pr_description); // this did not provide method or array such as `#suffix`
  }
}


texts: How to prevent users of particular role to access the content view (node view) of a particular content type?

texts:
I am using Content Access Module and have rebuild permissions after enabling the module.

After giving restricted access to users having role 'Data Entry Operator'.
I have a content type delivery challan for which I have ticked on the following permissions for the role ABC.
View own delivery_challan content(selected the particular permission for role 'Data Entry Operator' only ) and
View any delivery_challan content(unselected the particular permission for role 'Data Entry Operator')

Here is the screenshot of the permissions set in the content access module.

When I login as user having role Data Entry Operator , I should not be able to view the contents of type 'delivery challan'
But the issue is I am able to view the content
How can I prevent user from viewing this content??


texts:
I'm trying to query an other mysql database that has an completely other table-structure than drupal (no session, semantics table and so on). When trying to add the database to my config file I get these strange errors that I'm missing the semantics table.

I get the feeling that drupal is expecting that the other database is an also drupal database, which it is not..

My question is: how do I query and complete other other database (other user and table) the drupal way?

I already tried this but it gives the same problems: http://drupal.org/node/18429


texts: Config Entity list_builder controller path throws Route Does Not Exist error

texts:
I have created a custom config entity, which declares a list_builder controller to return a list of the created entities. Before creating a config entity, it renders as expected. Once I create a config entity via its add form, which redirects back to the list_builder controller, the error is thrown. The config entity is saved, but the redirect fails.

Here's the redirect in the config entity form class's ::save() method.

$form_state->setRedirect('my_module.entity.list');

Also, navigating directly to the list_builder controller path throws the same error.

  Symfony\Component\Routing\Exception\RouteNotFoundException: Route
  "entity.config_entity_id.edit_form" does not exist. in
  Drupal\Core\Routing\RouteProvider->getRouteByName() (line 187 of
  /home/vagrant/docroot/core/lib/Drupal/Core/Routing/RouteProvider.php)

I have no idea where the route entity.config_entity_id.edit_form is coming from. How to resolve the thrown error?


texts: Create a node's author by passing an argument...?

texts:
I have a view in which I can see a list of all my users.

I would like to be able to click on one of the names in this list and create a node and have the user that I clicked on be the author of this new node.

Is it possible to do this by passing an argument in the URL, or perhaps there is an easier way to do this that I had not thought of.

Thanks.


texts: Is there any way to make Commerce Customer Profile save/store data in a predictable manner?

texts:
Heres the thing. We have a customer profile of type 'Delivery' which contains a delivery address for an order. It also has other non-addressfield data like driver route, delivery day (M-F, day of week), default product (recurring order kit), and delivery frequency (how often to receive new orders).

The customer can, at any time, change their delivery frequency, default product, and delivery address. Here is the issue... any slight change and/or order reference and the profile is cloned. I get that Drupal Commerce does this to preserve historical order data integrity, however, the new profile ID needs to be assigned to all non-completed orders. We can't store this as a Profile2 object, because changing address or product affects their available delivery day and driver route, which has to go along with the order.

Orders are generated by the system based on this profile data... so it is important to maintain order reference and the 'newest' profile of record that is the basis for new orders and any editing. Profile data cannot be edited at the order level itself.

I am having a lot of difficulty wrapping my head around how to wrangle profiles to either prevent dozens of clones or making it make sense to administrators (Views reports will show tons of user profiles).

What is the most sensible way to manage this? Currently I have set up a Rule that when a customer profile is created or updated, the profile ID is proliferated through orders... but not sure this is the best approach.


texts: How to remove all nodes authored by users when their role changes?

texts:
I have two roles on my site: Standard and Premium. Standard users are able to upgrade to Premium accounts. When this happens, I would like to deleted all content that the Standard users has authored.

Can this be achieved with Rules? Or, is there a different way?


texts: How to create a form on settings o settings page

texts:
In template.php file I am using the following code.
function MYTHEME_preprocess(&$variables, $hook) {
  $variables['socialmaintenaceurl'] = "https://twitter.com/test";
  $variables['maintenaceurltext'] = "Get the latest news on Twitter";
}

This is just for the maintenance page. I like to have two form elements on my settings page to manipulate these two values from the administrative area.
Could anyone show me what I can put in theme-settings.php?


texts:
I have updated one of my D8 sites to the latest stable version - 8.3.1 using drush up. When applying the database update, the update fails with the following error message:

  Failed: LogicException: Missing bundle entity, entity type block_content_type, entity id basic. in Drupal\Core\Entity\EntityType->getBundleConfigDependency() (line 882 of /var/www/sitename/core/lib/Drupal/Core/Entity/EntityType.php).

This has only happened on 1 site, so it's possibly a config issue specific to the site.

How do I manually create the missing bundle entity?


texts:
To replicate the issue:

Install and enable Chosen module ->

(Apply Chosen to exposed filter)

Add .views-widget-filter-title to /config/user-interface/chosen under                 "Apply Chosen to the following elements"

Why is my chosen element present but inactive? (See picture)


texts: When and where does Panels get the title out of a View?

texts:
Two part question about Drupal 7, Panels 3, and Views 3.

I have a view that I have added to a content area in a panels page.  Right now, the title from the display is being used as the pane title.  I need to dynamically set the title of this from a module.

When does Panels pull out the display title from the view?
Where exactly does it pull it out from?

I cannot seem to override this from any view hook.  For example,

function foo_views_pre_view (&$view, &$display_id, &$args)
{
    $view->display[$view->current_display]->display_options["title"] = "Foo";
}

doesn't seem to affect the pane title, though the value does propagate through all of the other view hooks.

I suspect I can create a workaround and use a custom block instead of the view directly, but I would rather not do that in this case.

Thanks.


texts: Drupal 7 ckeditor relative path setup issue

texts:
We are developing a site using drupal 7
So we created drupal site with name of myapp, so the url is http://localhost/myapp

Also another developer is working for same site in his development machine with the name of myapp2
so its http://localhost/myapp2

I have installed ckeditor for rich content and configured relative path for inserting images.

When I insert an image in myapp site the relative path comes like 'myapp/sites/all/files/images/img1.jpg' instead of 'sites/all/files/images/img1.jpg'

hense when I share my database with my other team member uses myapp2 they are not able view the inserted images. their path looks like this 'myapp2/myapp/sites/all/files/images/img1.jpg'

I have used pathologic to setup the two users urls in Text Format setting page
like http://localhost/myapp and http//localhost/myapp2 but not works as expected.

any one help me what else I can do to solve the issue.


texts:
I have a Drupal 7 site and a Facebook page. I have created a tab on the Facebook page which should allow me to display a page from my Drupal site within the tab. On Microsoft Edge I get a warning saying that the site doesn't allow iframes, on all other browsers I have tried nothing displays at all.

I have enabled Security Kit, disabled X-XSS-Protection, allowed cross-site request  from https://facebook.com and disabled X-Frame-Options.

I enabled the iFrame entity module and allowed nodes to be iFramed.

And I have put $conf['x_frame_options'] = ''; in my settings.php.

I still am unable to display a node from my site on an iframe.

How do I get around this?

Thanks


texts: Customising image in the first row in a views

texts:
I would like to be print for the first row in different display style for the image field.
Thx all!

Title1

Title2

Title3

Title4

I tried using the php field.
Something like:

<?php
  if ($view->row_index == 0) {
    print $row->field_foto_principale;
  } else {
    print "other";
  }
?>

But I can not render the image.


texts: How would I upload a pdf and link it to a post on my homepage? Basically the PDF is a newsletter and every week I want to upload a pdf (newsletter) and have a link as a story on the home page. I'm using Drupal 7, is this possible? does a module exist for it?


texts: What is the syntax for l.d.o translations in a drush make file

texts:
I have read the Drush Make documentation, and understand you can download translations at the time you use the drush make command, since there is an option. What I don't understand clearly is how to add a translation from localize.drupal.org to your .make file. Any help and/or an example would be amazing. Thanks.

Drush Make documentation: http://drupalcode.org/project/drush_make.git/blob_plain/refs/heads/6.x-2.x:/README.txt


texts:
... preferably with PHP. I am new to Drupal.

My goal is to integrate a page into an already existing project which enables to give to users the possibility to book a Hotelroom or a flight ticket while the Administrator (me) then collects the submitted information and validates the choice in the backend.

I have done this countless of times from scratch in PHP with POST. But on Drupal, when I try to integrate HTML and PHP code into a new webform or new article page, it doesnt really render it.


texts:
I want to rename an up-loaded file. I have the following code. I have defined a submit handler to do so.

function example_form_submit(&$form, FormStateInterface $form_state) {
    if ($form_state->hasFileElement()) {

        $video_file_file_array = $form_state->getValue('field_video_file');
        if (is_array($video_file_file_array)) {
            if (isset($video_file_file_array[0])) {
                $video_file_file_id = $video_file_file_array[0]['fids'][0];
                if($video_file_file_id){
                    $file = \Drupal\file\Entity\File::load($video_file_file_id);
                    $file->set('filename', 'something');
                    $file->save();

                }
            }
        }
    }
}

This is not working. Is there any other way.


texts: Is it possible to bypass default 404 behaviour for ParamConverter with null values?

texts:
When upcasting route parameters drupal will automatically generate 404 page if ParamConverterInterface::convert() service returns null. Is it possible to override this behaviour and allow null values?

For example I'd like to load custom entity for a specific route however in case the entity doesn't exist, I'd still like to execute my controller code that will deal with null value on it's own.

With default 404 getting in my way, I can't use ParamConverter service and I have to load entity manually inside controller which is ugly.


texts: Access forbidden 403 to homepage but the rest of website working Drupal 7

texts:
I have Drupal 7 installed in localhost, with XAMPP, and it is a replica of a complete working site. I think I have configured everything ok as I can see all the site working nice, with its friendly urls, multilanguage, multidomain, dozens of modules. But still the home page is not rendered, with an Apache error of forbidden. When I try to put site_name/index.php, it gives a 404 error, and the same trick in remote works rendering homepage!!

Any idea or suggestion on what could be happening? Thanks.


texts: I am importing bulk data to my site using Feeds module. However, the module does not support i18n (languages) for taxonomies. I am thinking of updating the data directly at the database level, but then, what is the advantage of the module? Should I look for another module or combination of modules, instead? Thanks.


texts: How to make "Announce on LinkedIn" on by default?

texts:
I am using Linkedin module.

I want "Announce on LinkedIn" turned on by default. I am using Feeds module for RSS. It automatically created Feed and Feed Item Content types. RSS content is automatically saved as new node. But that node is not posted in Linkedin. I have to edit the content and manually check "Announce on LinkedIn" to have it posted:

I want it posted automatically. How can I achieve that? Please anyone help to me. Thanks in advance


texts: Pick latest node from taxonomy term supplied in node

texts:
I have 2 contenttypes.

Productpage and Blogpost.

The blogposts uses taxonomy (blogcategories) and is only connected to 1 term.

Now I want to use a dropdown on the productpages where I select a term (term reference) that I want to get the latest post from.

How can I accomplish this? I can't use the term reference field as a relationship in views so I don't know what to do.

Please help.

Kind regards,
Daniel Lundahl


texts:
I am very new to Drupal and Twig.

I've a custom Drupal theme I've built, but my client now wants a "blog" system as well. This includes the following features:

Show most recent article in a blurb on the home page
List out articles with pagination on an archive page
Assign categories and/or tags to articles which when visited list out articles similar to the main archive page
Show "posted on" date on article page

I've got the last item working just fine, but I can't find anything useful Googling around for the first three items.

I'm using Drupal 8 and twig templates if that makes a difference.


texts:
After having added a “changed by” on nodes I now need to display the user who modified each node on the node_admin_content form (at admin/content) right next to the "Author" column.

I've managed to easily solve this by altering node.admin.inc and adding just 2 lines of code:

...
'changed_by' => t('Changed By'),
...

...
'changed_by' => theme('username', array('account' => user_load($node->changed_by))),
...

This, of course, is not a proper solution since it alters the core.

So I then tried altering the form via:

function hook_form_node_admin_content_alter(&$form, &$form_state, $form_id) {
  $form['admin']['nodes']['#header']['changed_by'] = t('Changed By');
  // ... ?
}

Using dpm I can see that the form has the nodes in options. The problem is that this is the result of rendering the nodes as table options. I don't have access to the original nodes, nor do I want to re-execute the node fetch query in order to get the "changed by" information. I guess doing this in the form hook would not be solving it in the correct layer. Or is it?

So, what is a good way to alter the node_admin_content form to add more data that exists on nodes?


texts: Why doesn't watchdog() run when I execute my custom module from Drush?

texts:
I have a custom module that performs an import from an XML file. It can be invoked in two different ways: from a menu callback or a custom Drush command.
The import works fine and all of its watchdog() calls work fine when I execute it from the menu callback, but when it's executed from Drush, the import works, but no watchdog() entries are logged.
Why is this? How can I get watchdog() to work in this module when it's triggered from Drush?


texts: ThemeNegotiator not working for admin pages

texts:
I'm trying to use the ThemeNegotiator to change the theme of the add and edit pages of one content type. I've followed the following very extensive posts/blogs.

Don't use admin theme for adding editing specific content type

Dynamic theme switching in Drupal 8

Soft launching your new drupal theme

Choose your theme dynamically Drupal 8

I have a user that is allowed to see the Admin theme seven, but for one content type documenten I want him to see the front-end theme svds. I'm able to get this to work for front-end pages but not for admin pages. What I think is that the applies part doesn't match on the add and edit pages. So it doesn't know it's on a documenten content type. Does anyone has an idea on how to solve this?

Module structure:

theme_switcher
--src
----Theme
------SwitcherNegotiator.php
--theme_switcher.info.yml
--theme_switcher.services.yml

theme_switcher.info.yml:

name: Theme Switcher
type: module
description: 'Switch theme for specific Content Type'
package: SVDS
core: 8.x

theme_switcher.services.yml:

services:
    theme.negotiator.theme_switcher:
        class: Drupal\theme_switcher\Theme\SwitcherNegotiator
        tags:
          - { name: theme_negotiator, priority: -50 }

SwitcherNegotiator.php:

<?php
/**
 * @file
 * Contains \Drupal\theme_switcher\Theme\SwitcherNegotiator
 */

namespace Drupal\theme_switcher\Theme;

use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Theme\ThemeNegotiatorInterface;

class SwitcherNegotiator implements ThemeNegotiatorInterface
{
    /**
     * {@inheritdoc}
     */
    public function applies(RouteMatchInterface $route_match)
    {
        // Use this theme on a certain route.
        $node = $route_match->getParameter('node');
        if (!is_null($node) && $node instanceof \Drupal\node\Entity\Node) {
            return $node->getType() == 'documenten';
        }

        // apply default theme
        return false;
    }

    /**
     * {@inheritdoc}
     */
    public function determineActiveTheme(RouteMatchInterface $route_match)
    {
        // Here you return the actual theme name.
        return 'svds';
    }
}


texts:
I'm trying to create a node using PHP. The below code works fine until I use any language code other than 'LANGUAGE_NONE'.

$node = new stdClass();
$node->type = 'recipe';
node_object_prepare($node);
$node->uid = 1;
$node->language = LANGUAGE_NONE;
$node->title = $item['title'];
$node->body[$node->language][0]['value']= $item['description'];
$node->body[$node->language][0]['format']= 'plain_text';
node_save($node);

If I use "en" instead of "LANGUAGE_NONE" then the node is created without any field being populated. That is, there is only a title; the body is blank.

Locale module is enabled and i18n is installed and enabled.

What should I do?


texts: Hierarchy management solution(s)? (node or taxonomy)

texts:
I have a content type with a large number of nodes (70K+) and have integrated a straightforward, though custom, node hierarchy solution (node reference for the parent, sibling order using delta).

I'm implementing a custom hierarchy management tool and have started out playing with taxonomy because the hierarchy management is already present (drag & drop). However, core's default taxonomy management only goes so far, and though a good starting point, will not be suitable for a vocabulary this size (moving a large piece of the tree somewhere else isn't possible, as the vocab is paginated).

I then thought about a view combo'd with VBO, and a few custom actions, but i'm not sure drag & drop could be used with this method.

Question:
Have you used (or seen) a drag & drop hierarchy management solution (node or taxonomy) implemented either in views or a contributed module that fits this scenario?


texts: How to create dynamic drupal 7 taxonomy views

texts:
I have to create 1 view using taxonomy.

Let's take the example i have 8 categories: cricket, football, tennis, swimming.

I have to show this each category with their 5 latest articles.

Thew views should display database like

Cricket

List item
List item

Football

List item
List item

Like this all 8 categories with grid layout and 4 categories in row.

Right now what i am doing is creating 8 different views and showing on 1 page.

But this create issue when i am adding new category.

So it's dynamic view can help or i have to write code for this.


texts: How to change the delete Message "Are you sure you want to delete" in Drupal 7

texts:
I want to change the message "Are you sure you want to delete" to simple "delete".
Can someone explain how I can do that?


texts:
The Search API has a Node Access Data Access Alteration which adds info into the index which can be used to implement 'normal' drupal node access restrictions to searches.

This was working fine until recently when a particular user was granted one too many Realm + grant Ids: now the Search API is throwing a hideous exception that's killing my site.

Basically Search API seems to create a JOIN for each realm:gid combo, and MySQL is limited to 64 JOINS.

Is there any way around this or is it a limitation of the Search API?

Would using Solr (never done it), for example, provide a solution?


texts: Unable to get javascript to make first letter of every word LARGER on my site to load properly

texts:
I'm trying to use javascript to make the first letter of every word LARGER in titles with the class 'field-name-title' (so basically all nodes).

I found a couple of Javascript-based solutions online, notably here and here. But whenever I try and implement them nothing happens (by which I mean the titles that are supposed to be changed are NOT).

What's I've tried:

1) I replaced the boilerplate class name in the javascript linked to above with my class name (ir. replaced 'title-case' in the one with 'field-name-title', etc.).

2) I've ensured I have a first-letter class in my stylesheet with the following property:

.first-letter {
  font-size: 1.4em; // I also tried % such as 115%
}

3) I put my javascript file in js/first-letter.js. I referenced it in my .info file as 'scripts[] = js/first-letter.js.

4) I've flushed caches repeatedly (and besides aggregation is turned off).

What am I missing?


texts: What are some ways to tell if you are currently on the same Drupal installation as your code?

texts:
Currently I have to manage a few servers and there are a bunch of Drupal directories that all look alike. I'm also logged in as admin on the site, but what I want to find out is:

How can I tell if I'm working in the correct directory as the site I'm viewing?
What are some drush commands I can use to tell if I am in fact in the correct directory?


texts:
I need to build a main menu that is a subset of the regular menu. The design team thinks it would be better for user to have only the most important links in the main menu and not have everything. Some links are top level menu and some are sub menus. For this I was hoping to be able to add a field to the menu link item form as a drop down. When creating a link the user could use this dropdown to "promoteToMainMenuAsBigLink" or "promoteToMainMenuAsSmallLink" or leave none to not show the item on the main menu.

I'm looking for a similar solution as this Drupal 7 solution but for Drupal 8.

I was hoping to be able to add a column in the table menu_link_content_data beside 'expanded'. I was hoping not to have to record this information in an other table like shown in the d7 solution.

I was able to add a field to the link form in a custom module I build, just for test purpose I only added a text field to start with:

custom_menu.module:

function custom_menu_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if($form_id == 'menu_link_content_menu_link_content_form') {
    $form['promoteToMainMenu'] = array(
      '#type' => 'textfield',
      '#title' => t('Promote to main menu'),
      '#description' => t('Promote link menu to main menu.'),
      '#default_value' => '',
      '#weight' => -9
    );
  }
}

The field is indeed shown in the link form but it is never recorded.

Can someone help me with this?


texts: How do I handle third-party API credentials in settings?

texts:
I am building a module that will need to integrate credentials for the 3rd party service in Drupal 8. The module's admin panel should remember the credentials and use them to interact with the service, but still hold them secure. Storing the credentials un-encrypted or exporting them in config with drush cex can pose a threat. How are such cases to be handled in Drupal 8? What is a good way to handle secure 3rd party credentials with Drupal 8?

Details: A module integrating with the 3rd party online service. This service provides credentials, that the user inserts in the module's admin form, and then can use the services. It won't do to hard code the credentials in PHP, and saving them as config in Drupal 8 will result in them being exported with drush cex. So, there is a need to store secure data in the settings, and keeping it from export when config is exported.


texts: Somebody is trying to brute force the password

texts:
Looking at the site log, I found, that somebody with IP address: 91.236.74.135 is methodically sending requests to the page: /user?destination=node/add of my Drupal website. He does it once in every hour. It's definitely a bot. I think, he's trying to brute force the password. For now I banned him in .htaccess with

deny from 91.236.74.135

Can anybody give an advice, how to protect the site from brute force attacks on logins?


texts: Can't disable css caching and aggregation

texts:
I've recently installed some modules including wysiyg, ckeditor, ajax comment, b2 nice comments.

I then noticed that my css files became cached and aggregated when inspect my pages.
I unistalled all the modules and double checked the options in the performance menu which were correctly disabled.

The weirdest thing is that I restored the files and DB to an older version and it didn't help.
I ported the site to another directory within the server (under a different domain) and the problem disappeared.

Anyone with similar experiences or ideas as to what might be the cause ?


texts:
I have set theme handler for a form in Drupal and this handler has a template file.
What is the easiest way to send a value from PHP to JavaScript in that include file?


texts: Tree structure based on parent-child relationship among content types

texts:
I want to store technical_specifications of various products. As different product categories obviously have very different types of specifications, what I had in mind was a tree structure of content types, only to find out that Drupal's content types don't support parent - child relationship out of the box (ie. a content type cannot inherit fields from another one)
I'm thinking something along the lines of
- PRODUCT
- price
- weight
- url
    - COMPUTER
    - (inherits everything from product, plus)
    - processor
    - RAM
    - (...)
        - LAPTOP
        - (inherits everything from computer, plus)
        - battery
        - touchscreen?
        - screen size
        - (...)
    - TV
    - (inherits from product, then)
    - screen size
    - contrast ratio
    - resolution
    - refresh rate
    - (...)
    - BOOK
    - (inherits from product, plus)
    - author
    - title
    - genre
    - publication date

...you get the idea.
What is the 'Drupalish' way to achieve this?
I could, of course, create separate content types for every product category (since you only create every content type once, and you can re-use existing fields, it's not a whole lot of extra work), but that wouldn't reflect the structure and hierarchy of the product categories
Or I could dump every field in one big content type, make them optional and only fill out what's relevant to that specific product (or category, rather)
Neither of these sound optimal. Any better ideas?
thanks!
(I'm running Drupal 8, btw, if that is of any importance)


texts: Using a PHP class defined in the module file inside the implementation of hook_install()

texts:
If the implementation of hook_install() of my module needs to use a class defined in the module file, should the code first load the module file with drupal_load()?

I would think that when the hook is invoked, the Drupal registry has not been yet updated to contain any reference to the PHP classes defined in the modules used by my module, and which are referred in the .info file. I looked at Drupal code, but I could not find any proof for what I think Drupal does.

Should I use drupal_load() or the file will be loaded automatically when I try to create an instance of the PHP class defined in the module file? Is it different with hook_update_N()?


texts: Create custom and unlimited Node list per user

texts:
Lets suppose I have a content type (movie) and I have all movies of Hollywood, I want let  each user can create it's own lists,as example I want to create "My Top 10 movie","My 12 Hot movie","Top fincher","Top Kubric" etc,I know I can do it by Nodequeue module,it is good for users that know how work to Drupal Nodequeues ( they should first create a nodequeue add machine Name and its machine name should be unique(select machine name that the other users not create it before) then surf the site and find desire movies and go to nodequeue tab and add that node to it`s nodequeue (really is it too hard for popular users)),But my problem is my user of website is popular web surfers ( not Drupal expert).

Also I can create a content type ( movie lists)  with entity reference,each user can create a node of movie lists, add desire movies by auto complete field and save it.

I want to know is there another way to create  lists of nodes per user and each user could have serveral lists and can control add/remove nodes to their lists ?


texts: Add ctools processing for content loaded via ajax

texts:
I have a search result page where all the searched results are loaded using ajax call. For each result, there is a button which should open a form in the modal.

The code snippet which is loading a button on the search result is as follows:

$build[$entity->id]['footer']['footer-bottom-section']['view-modal-form'] = array(
        '#type' => 'markup',
        '#markup' => l(' Get Best Price', 'request/add/'.$space_id.'/'.$entity->id, array('html'=>TRUE,'attributes'=> array('class'=>array('btn','btn-orange', 'pull-right', 'ctools-use-modal')))),
    );

The button is loaded properly on each search result, and it has all the classes provided. But it does not have ctools-use-modal-processed class.

I know the reason since the page is already loaded and results are added to the page through ajax after load finishes, ctools is not finding ctools-use-modal class to process.

I would like to know, how can I trigger ctools to process my ajax loaded search results so that it can add modal form for each searched result?

EDIT: Following is the js function which is calls a custom menu callback function, to load results:

function fetchNext(url, $parent) {
    $parent.append('
Loading
');
    $.get( url, function( data ) {
        $parent.append( data );
        $('.load-next').bind('inview', function (event, visible) {
            if (visible && !($(this).hasClass('disabled'))) {
                var url = $(this).attr('href');
                fetchNext(url, $(this).parent());
                $(this).remove();
              }
            });
        $('.load-next').click(function (event) {
            event.preventDefault();
            var url = $(this).attr('href');
            fetchNext(url, $(this).parent());
            $(this).remove();
        });
        processAfterLoad();
    }).fail(function() {
        $('#space-loading').text('Error in loading spaces. Please refresh page');
    });
}

This is line which calls above function:

$('.load-next').bind('inview', function (event, visible) {
            if (visible && !($(this).hasClass('disabled'))) {
                var url = $(this).attr('href');
                fetchNext(url, $(this).parent());
                $(this).remove();
              }
            });

Following is the kind of URL which will be called:

/lazyspaces/<Google places api locality>?<lat, lng, geolocation, sort, page>

for e.g.:

/lazyspaces/Thane-West--Thane--Maharashtra--India?lat=19.2444738&lng=72.9814877&geolocation=Thane%20West%2C%20Thane%2C%20Maharashtra%2C%20India&sort=distance&page=2&plain=1&lastdistance=8.80

Menu callback:

$items['lazyspaces'] = array(
        'title' => 'Find a Space',
        'page callback' => 'discover_lazy_spaces',
        'access callback' => 'entity_access',
        'access arguments' => array('view', 'space', 1),
        'file' => 'includes/search.utils.inc',
);

Here discover_lazy_spaces function, extracts get parameters and send it to a query to fetch results from database and then builds result list.


texts: D8 Views Template Suggestions Being Ignored

texts:
I went through other questions/answers on this topic and I am still stumped. My added template suggestion for a Views Exposed form is being ignored.

function talon_theme_suggestions_views_exposed_form_alter(array &$suggestions, array $variables) {
      $suggestions[] = $variables[form]['#id']. "__ef";
}

Template name in theme: views-exposed-form-views-programs-block-1--ef.html.twig

Theme Debug lists suggestion as: views-exposed-form-views-programs-block-1--ef.html.twig


texts: Best practice for template theming - #markup vs safe_value

texts: When doing complex display logic and breaking apart a renderable array in a field collection template, what's the best string output to use from the array: #markup, or safe_value? Presumably #markup is already run through the right filters... right?


texts:
So I want to provide similar redirection logic as we have on drupal.org and redirection to dashboard to logged in users but also allow access to the /front page. I can't seem to get it to redirect ONLY on front page. Here is the current code I have:

function MYMODULE_init(){
  global $user;
  if(drupal_is_front_page() && user_access('view own dashboard')){
    drupal_goto('user/'.$user->uid.'/dashboard');
  }
}

It is also redirecting the page itself to the dashboard still and not simply the <root>


texts: How to apply Image Styles to images that have been added to published nodes?

texts:
We have an image field (field_image) that did not have an image style originally applied. In the end we have hundreds of nodes (pages) where the Image style is not present. When adding an image style to the field under the respective View Mode, we are still getting an image without the image style applied.

How can we enforce the image style to be applied to currently published nodes?

Current results:

Desired results:

What we have tried that didn't work:

Flush image style
Cleared cache


texts: Remove "Submitted by [user] on [date]" from content shown on a Views page

texts:
How does one remove the "Submitted by [user] on [date]" bit from content shown on a Views page?

I am assuming it is to remove some php code, but unsure what php file the code lives in. (I tried node.tpl.php)

I am using Drupal 7 Bartik theme.

Thanks in advance.


texts:
Can the Views Module assign a value to the  and/or $title variable?

More specifically, I would like the Views Field: "Content Title" to be the $title.


texts:
How to add a specific Organic Group to a node in the action-step with rules (7.2)?

I can't figure out which action and which options i should use. Now i've something like

**action**
Set a data value
Parameter: Data: [node:og-group-ref:0]

But this isn't correct. How can i give the og-group-ref the correct value (the OG is in this case nid 180).


texts: Product View does not show for Anonymous user

texts:
I would like to use a view to display products in front page. So, in the view 'Products (Commerce Product)' i created separate block view 'My Products Block'. This view is added to the region in Block section and then rendered in the front page:

print render($page['region_containing_product_view']);

This displays products fine if logged in as admin but not for anonymous users. For anonymous users it shows:

No products have been created yet. Add a product.

I have updated the permissions for my custom view to 'Access:Role | anonymous user' but it still doesn't show the products. How come? what am i doing wrong?

Thank You
p.s. Drupal 7, Commerce module


texts: Drupal alias to the last node of one type

texts:
Imagine I have a node type of congress, i want to create a menu called congress.html how always go to the last node of this type.

How can i do it.


texts:
I am trying to customize the access of user fields. We have an internal list of all users, which all members can access (for things like mail/address/phone number). However, due to privacy, each user should be able to manage these field, and can hide certains fields from showing to particular members or groups.
For this, I created a database table which stores all preferences, and fetch them using dynamic query. For the field access, I use
function MY_MODULE_has_access($operation, $field_machine_name, $uid){
  Code for determining access here
  return if $uid has access
}
function MY_MODULE_entity_field_access($operation, $field_definition, $account, $items = NULL) {
  if ($field_definition->getName() == "field_address") {
    $user = \Drupal::currentUser();
    $result = AccessResult::forbiddenIf(!MY_MODULE_has_access($operation, "field_address", $user->id()));
    $result->addCacheableDependency($user);
    return $result;
  }
  return AccessResult::neutral();
}

However, due to caching, this only works one time. If the user changes its preferences, the field access still remains unchanged. How can I fix this?


texts:
I am running a test that extends a BrowserTestBase and indicated a custom module as a dependency. The module has a mymodule_module_preinstal() that is supposed to perform a DB query using Drupal::database().

After wasting some time on figuring out why it does not work I realized that the query is run against the main databse of the installation, not that which I had set up in phpunit.xml.

That's really confusing - why is it working like that and why on earth would I want to work with the main database while running a test which is supposed to be run in an isolated database?

And, most importantly, how do I run the query against the test database?

Excerpt from documentation:

  It's terribly important to realize that each test runs in a completely new Drupal instance, which is created from scratch for the test. In other words, none of your configuration and none of your users exists!

Here's code of my test:

class FormTest extends BrowserTestBase
{
    public static $modules = ['mymodule', 'mymodule2'];

    public function testFormPage()
    {
        $response = $this->drupalGet('/mymodule/register');
    }
}

I've also copied phpunit.xml.dist to phpunit.xml and set up this line:

<env name="SIMPLETEST_DB" value="mysql://mydb_tests:password@localhost/mydb_tests"/>

I run my test like this:

cd core
phpunit ../modules/mymodule/tests/src/MyTest.php

I have installed the version of phpunit from core/composer.json globally.

The preinstall hook looks like this:

/**
 * Module preinstall hook
 * @param $module_name
 */
function mymodule_module_preinstall($module_name)
{
    var_dump($module_name);

    print_r(Drupal::database()->query("SHOW TABLES")->fetchAll());
    exit();
}


texts: Passing values from EntityFieldQuery to db_select

texts:
Checked for this, but don't seem to be any specific answers to this question.

I'm trying to pass results from EntityFieldQuery to a db_select query, via a string. However, although debugging both queries with set values shows that they are operating correctly and providing the desired results, when using the string in db_select I am getting null results.

The purpose is to get certain node ID's as an integer value and pass them as an array of Entity_ID integer values, so the db_select function only selects table rows which match a certain Entity_ID.

I presume I'm making a output format error for the EntityFieldQuery, but can't work out what exactly it is.  Code is as follows:

// EntityFieldQuery
$query = new EntityFieldQuery();
$entities = $query->entityCondition('entity_type', 'node')
                   ->entityCondition('bundle', 'contenttype1')
                   ->propertyCondition('status', 1)
                    ->fieldCondition('field_field', 'value', $contenttype2, '=')
                   ->fieldOrderBy('field_field', 'value', 'ASC')
                    ->execute();

// Debugging functions only, return correct values when tested
$show = array_keys($entities['node']);
echo 'this is show: ' . $show;

$print = var_dump($show);
echo 'this is print: ' . $print;

// db_select function, returns correct sum when '$entities' is replaced with integer value for entity_id
$dbquery = db_select('tablename', 't')
  ->condition('t.entity_id', '$entities', '=');
$dbquery->addExpression('SUM(value)', 'value');

$result = $dbquery->execute()->fetchField();

// Debugging function only
print 'this is result: ' . $result;

The EntityFieldQuery is producing the correct values, but it isn't clear that they are in the correct format. The $print output is:

array(2) { [0]=>int(213) [1]=>int(214) }

At present, the SUM result works correctly when I replace '$entities' in the db_select with (e.g.) '213', but returns 0.0 when I use '$entities'.

EDIT: using

dpq($dbquery);
dpr($result);

Gives the confirm message:

SELECT SUM(value) AS value
FROM
{votingapi_vote} v
WHERE  (v.entity_id = )

And the error message:

Warning: PDO::quote() expects parameter 1 to be string, array given in dpq() (line 1835 of /var/www/html/sites/all/modules/devel/devel.module).

What is the output format code / function I should be using for EntityFieldQuery?


texts: Add a field to multiple content types at once?

texts:
I want to add a field to multiple content types at once, and configure it for all of them at once as well.

Reason being is that I have many content types, all of which need to be updated by adding this new field to each.  This field will be configured the same for all of the content types as well.  I have to repeat this process of adding and then configuring the field every content type I want to add it to, and it gets arduous after a while.

Is there any way to do a mass add/configure of a new field to many content types?


texts:
have inspected element for this site and try as I might changing bg color in body for style.css makes no difference no matter how much caches are cleared.

I want to leave the tiled background and just change the inset white to another color. I didn't see background color in LAYOUT REGION sorry..this has been solved now.


texts: Merging duplicated nodes, and their fields

texts:
I am looking for a coded way of merging two nodes (of same type), with user interaction ("guided merge").

In my case,I made a simple contact manager. It imports (Feeds csv import) from, and exports (node export to CSV) to various sources, e.g. some social networks contact lists, webmail and thunderbird files. I want to manage the people data from there exclusively.

I use in first place a content type "person" with mostly simple text fields (e.g. name, email, phone, city).
As you might have encounterd, frequently there will be duplicate nodes, but one of them most of the time holds the more accurate info about the person.

So I am in need of a tool to:

Let me checkbox-click two nodes (from the generic view)
Show both nodes side by side
Let me choose one as master
Click "Go" to start the merging:

Merge automatically all new fields from secondary node into master
For fields with values in both nodes, show them both
Let me click, which one should be used and provide an prefilled form to edit the value
Submit the field value, then show the next field
Continue until the node is done
Save the updated master node, and delete the second node

My research until now has not shown results (discussions, modules) in that direction.

Do you have any hint on what to search for? Should I start a new module?


texts: Translation not working for custom user roles

texts:
I am using the i18n module. I created 2 custom roles: venue user and customer user. When I log in as administrator user, the translation is working fine; when we log in either as venue user or customer user, the translation does not work.

How can I solve this problem?


texts: Module recommendation needed for recurring monthly membership plan?

texts:
I’m building a site that features yoga/excercise videos and will require users to sign up as members which will require a recurring monthly payment. Could someone recommend which modules to use for this? i see there are a few different options available. Any experience with something like this or advice would much appreciated, thanks!

i also need to make these videos inaccessible to non-members, something else to consider


texts: How do I update the section component configuration?

texts:
How to update a component in the node's layout builder? I  have used the following code.
$node = \Drupal\node\Entity\Node::load($nid);
$layout = $node->get('layout_builder__layout');
$sections = $layout->getSections();
foreach ($sections as $key => $section) {
      $components = $section->getComponents();
      foreach ($components as $component) {
        if ($component instanceof SectionComponent && $component->getPluginId() === 'myplugin_id') {
          $configurations = $component->get('configuration');
          $configurations['label_display'] = "0";
          $component->setConfiguration($configurations);
        }
      }
}

But now I don't know how to update the section and layout of the node.
Because $section->setComponent($component) is a protected method.


texts: Filter posts date from a dropdown with views

texts:
Hello i'm trying to make a dropdown that will allow users to select posts from:
 -a month ago
 -a week ago
 -a day ago
 -an hour ago

Is this possible with views?

I've fillterd with "Node-> Post date" and  an offset of "-1 week" and the operator is "greater than or equal to." but this is giving me only the last week posts. Can this be done with views? or can you tell me another module that is making that?


texts: Is there an ready-made solution to mark edited form fields?

texts:
When you edit something in text editor or IDE, you get visual feedback - star next to file name, bolded file name et cetera. That way you easily know what has been edited and what not.

Is there a ready made solution to introduce that to Drupal? Either system-wide or manually using Form API? It would make sense to see if any changes was made or not, especially if one opens dozen of nodes for updates and then sees some of them are already up to date and does not need a save (and associated boost cache clears).

In large setting forms, like permissions or Elysia Cron, it would help too.

The ideal would be to add some class to each field with value not equal it's default value, so the theme could deal with it using only CSS.

Anyone written it already?


texts: Tracking multiple items in a Commerce order individually

texts:
I need to track items individually in a Drupal Commerce store that I'm building, and I'm wondering if anybody here have an idea how to make this happen. Let me expand on this a bit:

If a customer puts 3 items in the cart, does the whole checkout process, pays for them etc. the store manager should be able to set statuses individually for those 3 items.

Most of the times these items will be shipped seperately, therefore the store manager should be able to set the first item to shipped while the other two is pending for example.

The only solution we've came up with is to explode the order into three seperate orders so after that one order, the store manager would see three orders with each product on the admin interface. Making this solution happen perfectly (set the right order totals to each order, set them to paid after the one payment, delete original order etc) introduces a lot of problems and it's a lot more complicated than we've expected.

Is there more straightforward, better solution out there for this purpose?

Thank you!


texts: display the entities that are referencing the current entity with views

texts:
I have a content type "reservation" and another "room" this is a simple booking app that Im making from stracht "just for learning purposes"

Im using entity reference for make the reservations, so I can create a new reservation and reference the room it belongs to.

So I need to create a view into a block that displays all the reservetions for the current room.

So how to make that in views?
display all the entities that are referencing a certain entity.


texts:
What is performance cost of executing queries like EntityFieldQuery directly in tpl.php files ?

I have some situations, where i have put db queries and more complex php logic in various tpl.php files.

It works, but my concern is performance.
What are best practice ? Should i move those queries somewhere else and what are advantages ?

Thanks!


texts: use menu item title instead of page title in breadcrumbs

texts:
I have been trying to display the menu item title as the trailing item in my breadcrumbs, other than the page title.

At this point, I override the template_breadcrumb() function with a custom function. At the end of the string variable, I have put drupal_get_title() to append the page title to the breadcrumb trail.

Please find a snippet out of the breadcrumb function below:

foreach($breadcrumb as $value) {
  $crumbs .= $value;
}
$crumbs .= drupal_get_title();

Now, when available, I would prefer the linked navigation item title to be displayed as trailing breadcrumb item. If not available, I will display the page title.

How can I check if this page is attached to a menu item, and retrieve the title, in order to display it as a breadcrumb item ?


texts:
I have a custom module that is adding a new field in the form in hook_form_alter().

In my hook_form_alter() I have

function mymod_form_alter(&$form, &$form_state, $form_id) {
     $form['complaint']['complaint_category'] = array(
        '#type' => 'select',
        '#title' => t('Complaint'),
        '#options' => myfuc(),
        '#required' => TRUE,
        '#empty_option' => t('Choose complaint category'),
        '#default_value' => $selected_complaint_category,
        '#ajax' => array(
          'callback' => 'mymod_complaint_dependent_dropdown_callback',
          'wrapper' => 'dropdown-complaint-remark',
        ),
      );
}

If I add a break point in my code in the function mymod_complaint_dependent_dropdown_callback() it is not triggered. Another element in the form has a #ajaxsetting and a break point on it works.

In the UI no spinner is added to the page. So it looks to me like the ajax event is not being registered. Any ideas?


texts: How to hook into views field criteria dropdown filter

texts:
I have created a custom view which allows me to filter my nodes by my taxonomy 'city'. The nodes are linked to the taxonomy by a term reference. I need to be able to programatically remove values from the dropdown list of cities which are shown as a filter form on the view.

I have looked at hook_field_views_data_alter() - I am sure the answer lies here but not sure where to go with it.

So basically, I want to pragmatically edit these values which are shown in my view.


texts: Clean Urls without HTACCESS on WebDav server

texts: I am not able to have a .htaccess on my webdav server. Am I completely out of luck to use clean urls on my Drupal 7 install? If not, how do I go about this? I've read a ton of posts, but they all relate to .htaccess enabled.


texts: Views: how to ASC sort the grouping field #1 and sort DESC its content?

texts:
I have views grouped by year (grouping field #1) that I want to sort from the most recent to the oldest. I have content referenced to the year.

This returns me a HTML list such as:

2013
- alpha
- gamma
- beta
- delta

2012
- zeta
- gamma
- epsilon

The years are correctly sorted (DESC) but I would like to have the content of each year sorted ASC to have the content listed alphabetically to have a list like this:

2013
- alpha
- beta
- delta
- gamma

2012
- epsilon
- gamma
- zeta

I have of course tried to apply a ASC sort on the content but it affects the years also and they become ASC sorted as well.


texts: Use hook_menu_alter to change access callbacks

texts:
I'm trying to working with hook_menu_alter, I'm tryng to change, for example, access callback to an admin path (admin/config/account/people/fields).

I've create a permission and I've added to a role.
Now I'm trying this:

function mymodule_menu_alter(&$items) {
   $items['admin/config/people/account/fields']['access arguments'] = array('my custom permission');
}

But it doesn't work.

Can I edit this "system" modules permissions?


texts: Make a relationship to last element of a Field Collection

texts: I have a View with a relationship to Field Collection (with unlimited cardinality). I need this relationship to connect only to the last element (having the largest delta). How can I do this?


texts:
I have a major problem with my system's cron; it runs every 3 minustes causing a slow responding from the site. When I checked the logs, I found this error:

  Attempting to re-run cron while it is already running.

I found some good answers on Cron stopped running; logs say: "Attempting to re-run cron while it is already running." but when I searched for the cron_semaphore variable in variable's table I didn't find it.
Even after I disabled the Search module, and uninstalled it, nothing happened: The cron tasks are still not working.

I checked, and I noticed that the cron tasks have been executed 1 day and 7 hours ago, although I configured it to run every 12 hours.

I am using Drupal 7.19.


texts:
I’m using ajax_links_api and for some reason it doesn’t work as expected. When I load page through AJAX I want to include .js files which weren’t already included in a page using <script> tag.

I am doing it through behavior.

Using Drupal.settings.ajaxPageState.js I can obtain list of .js files that I want to include, but some of them have been already included, so I want to avoid duplicates.

How can I get the list of files which were already included?
drupal_get_js() won’t work because it is AJAX.

And after I get the list of the files that I want to include, how can I include them?


texts: Field Collection fields causes errors in array_flip functions in /includes/entity.inc

texts:
This is a follow up question from this question. I now am sure that it's the Field Collection module that causes the error message "Can only flip string and integer values!". My previous question was about HOW to find which module causes the error. I have now used Xdebug and Atom to backtrace the stack like this:

When the error arises on row 175 in /includes/entity.inc I have these values in the variable $ids:

$passed_ids = !empty($ids) ? array_flip($ids) : FALSE;

As you can see it's an array in an array, which causes the error, as array_flip() only can flip integers and strings, not arrays.

The array in an array value comes from row 8016 in /includes/common.inc:

function entity_load($entity_type, $ids = FALSE, $conditions = array(), $reset = FALSE) {
  if ($reset) {
    entity_get_controller($entity_type)->resetCache();
  }
  return entity_get_controller($entity_type)->load($ids, $conditions);
}

Going one step further back in the stack, the value comes from these rows in sites/all/modules/entity/entity.module:

function entity_load_single($entity_type, $id) {
  $entities = entity_load($entity_type, array($id));
  return reset($entities);
}

And if you bare with me, one more step back in the stack... to sites/all/modules/field_collection/field_collection_entity.inc, where I find these rows (row 265):

  public function hostEntity() {
    if ($this->fetchHostDetails()) {
      if (!isset($this->hostEntity) && $this->isInUse()) {
        $this->hostEntity = entity_load_single($this->hostEntityType, $this->hostEntityId);
      }
      elseif (!isset($this->hostEntity) && $this->hostEntityRevisionId) {
        $this->hostEntity = entity_revision_load($this->hostEntityType, $this->hostEntityRevisionId);
      }
      return $this->hostEntity;
    }
  }

Now to my question... what happens is that the host entity id (26391) is passed up the stack once for every field collection field that exists on the page. 10 field collection field instances = 10 error messages on row 175 in /includes/entity.inc (and equally many on row 388).

Can anyone tell me what I might be doing wrong? I suspect I have drawn this error upon myself. All other posts I have read among the issues for Field Collection suggests that this shouldn't be a problem any more. Otherwise I would have posted this in as an issue for Field Collection.

The field types I am using in these Field Collection fields are: Image, Long text and Link.

What more info can I give you to solve this problem? I am not an expert coder, so maybe there is something obvious in the stack above, that I don't see?


texts: Creating static pages on production from a local module

texts:
This question could have multiple types of answers, so I'll take anything you guys have to offer.

I have to transform an XML feed into a set of Pages (content-wise).  Currently, I have a module I'm developing locally using PHP and SimpleXML in order to dynamically simulate these pages (so, each page being rendered is a completely dynamic thing controlled by the module).

I need to take this output and create a set of static pages on a production server.  One painful thought I had was to render each page, copy the generated HTML, and physically create a new node.  As there are a lot of pages being generated, this would be a long and drawn out process.

What would be nice is for some method to render all these pages in one go, and then somehow push them to my production Drupal installation.

A caveat, which would be more in the nice to have category is that it is possible for the XML feed to change.  So, it'd be nice to, for instance, mark the changed text in a different color, or produce a new revision, or something along those lines.

I am using Drupal 6 (with no plans to upgrade).

I'll add an extra specific on this question.  At present, I am using SimpleXML to walk through my feed, and using PHP to dynamically create an HTML tags I need.  Essentially, I'm building up a string of HTML that gets returned from the module (in a _module_generate() function), which is then displayed by Drupal.  If there is an easy way to take this, perhaps turn it into a Cron job, and have it produce some kind of output for the Feeds module (thanks @Clive), then that may be the easiest thing for me to do.


texts:
I am having an issue with completing my event calendar. Everything is in place but the header is all jacked up. For every month, it gives the header as August 1, 2014, September 1, 2014. It is VERY frustrating. I went through everything (the calendar View) and some of the PHP but cannot find anywhere the issue!

Does anyone know how to fix this? I tried looking online and I cannot seem to find the solution anywhere! I even went into the settings for time/date and could not find a single thing.

I want to say that the current date is August 22. I could see if it was August 1 for it to display like that but it is not! I would like it to say AUGUST 2014 or just simply August! Not the WHOLE date typed out.

weekly view:

looks fine!

So if anyone out there can please help me fix this issue, I would so much appreciate it! I have been playing around for hours and to no avail! It must be something simple, right?

Thank you!


texts: Why Role::getPermissions() method return an empty array for admin users?

texts:
Searching the answer for How to get user permissions for the role Administrator? I found that if you try to get the permissions for the admin user you will get an empty array.

From Role::getPermissions():

  /**
   * Returns a list of permissions assigned to the role.
   *
   * @return array
   *   The permissions assigned to the role.
   */
  public function getPermissions() {
    if ($this->isAdmin()) {
      return [];
    }
    return $this->permissions;
  }

But if the admin user have all the permissions why Drupal just return an empty array?


texts:
Formatting looks OK in input field using CKEditor  but does not appear on page when published?

CKEditor is installed and working OK    but the formatting is not applied to the published text

anything obvious I might be missing ?


texts: Delete field and related data (field_delete_field, field_delete_instance)

texts:
I want to delete field from my Content Type using hook_update and wondering how to do it in most correct way.

I know that my field is only on 1 Content Type (page).

Here is my current solution.

function site_deployment_update_7001() {
  $fieldname = 'field_landing_page';

  if ($field = field_info_instance('node', $fieldname, 'page')) {
      field_delete_instance($field);
  }

  if ($field = field_info_field($fieldname)) {
    field_delete_field($field);
  }
}

However I'm a bit confused if I need to do field_delete_field after field_delete_instance. It's because on Drupal.org says that field_delete_instance doing field_delete_field as well (with condition: condition count($field['bundles']) == 0). I'm wondering about this condition, in what cases it is 0?

https://api.drupal.org/api/drupal/modules!field!field.crud.inc/function/field_delete_instance/7

function field_delete_instance($instance, $field_cleanup = TRUE) {
  // Mark the field instance for deletion.
  db_update('field_config_instance')->fields(array('deleted' => 1))->condition('field_name', $instance['field_name'])->condition('entity_type', $instance['entity_type'])->condition('bundle', $instance['bundle'])->execute();

  // Clear the cache.
  field_cache_clear();

  // Mark instance data for deletion.
  $field = field_info_field($instance['field_name']);
  module_invoke($field['storage']['module'], 'field_storage_delete_instance', $instance);

  // Let modules react to the deletion of the instance.
  module_invoke_all('field_delete_instance', $instance);

  // Delete the field itself if we just deleted its last instance.
  if ($field_cleanup && count($field['bundles']) == 0) {
    field_delete_field($field['field_name']);
  }
}

Please advise what are the best approach to delete field. Thanks!


texts: Use Views to display unpublished nodes to authors, but not to other users

texts:
Say [User A] creates, but does not publish [Node 1]. [Views V] aggregates all of the content type that [Node 1] belongs into. [User B] should not be able to see [Node 1] listed on [Views V], but [User A] should be able to see his own unpublished [Node 1], all through [Views V] which lists out the specific content type.

Currently, if I change the Filter to not filter for Published or Unpublished nodes, then regular members can see the title of unpublished Nodes through the view, despite not having permission to access it (if the user clicks on it, then access denied message is shown). I do not wish for this to occur. However, I can't explicitly filter out unpublished nodes, since I want authors of said nodes to be able to see them (and access/edit them before publishing).

So is it possible to have Views filter out nodes based on the access permission of the current user?

I am using Drupal 7, and Views 3.


texts:
I made Views page in table format.
2 columns. In the left - image in format 220x220 (resizing by Drupal). Right column consists from text.
When I see page from Chrome, I noticed that images in first comn are extremely small.

What can be the problem?