texts: Broken formatting while displaying both start and end date

texts:
I added Event content type in D7 and I have there Event Start date. I setup this field to collect an End day + it is collecting time and have option to check "All Day Event".

What I have in the exit when I created new Event is something like:

Frida2013, 20-Sunda2013, 22, Frida2013, 20-Sunda2013, 22eptember Frida2013, 20-Sunda2013, 22, 2013 - h:ia(All day)-(All day)

When I go to Manage Display tab, I can set there for Event Date to display only Start Day for example and then this broken formatting disappears. But I need to be able to display both Start and End date.

Any suggestions appreciated.
Thanks.


texts: Front class not included in body tag in my custom module

texts:
We are trying to make a Drupal mini bootstrap for our language selection module.
We implemented hook_boot(), in this function, we included path.inc and common.inc from core.

The language selector always redirects to the frontpage of the according language.
Now the problem is that, when loading the new page, the class of <body> is not-front. This means that front-specific styles, and template are not used; it just uses the default ones.

We are guessing that we missed something in the Drupal bootstrap process.

Do you have any idea?


texts: Restrict IFRAME and OBJECT embeds certain domains

texts: I would like to allow my users to embed certain IFRAME and OBJECT tags in nodes and comments. Is there a way to restrict them to certain domains, for example maps.google.com to allow embedding Google maps?


texts:
Is there a way to add a billing method/status line to invoice, generated by module Commerce Billy PDF?

I've been looking for a way for days and still cannot figure it out......


texts: How to write webform settings and conditions programmatically

texts:
I'm trying to create a webform on my node programmatically so that I can set it up to be used as for a specific scenario. What I wanted to do is have all of the components my client want to appear automatically, but also default to specific settings for user entry, email specific users and validation rules etc, because they are going to have the same setup for each one, and they aren't going to want to write their setup out every single time.

I was using the Webform Default Fields module, but I know that this only works with the components, and not the setup. So I got rid of it and started writing my own version, with big help from this answer to get me as far as I am right now. But I'm struggling to find the correct format of how to write in a conditional statement, or how you would set the settings for the webform.

My current code is as follows:

function mymodule_node_insert($node) {
  if ($node->type == 'event') {
    _abstract_webform_components($node);
  }
}

function _abstract_webform_components($node) {
  $components = array(
      0 => array(
        'name' => 'First name',
        'form_key' => 'first_name',
        'type' => 'textfield',
        'mandatory' => 1,
        'weight' => 1,
        'pid' => 0,
        'extra' => array(
          'private' => 0,
        ),
      ),
      1 => array(
        'name' => 'Last name',
        'form_key' => 'name',
        'type' => 'textfield',
        'mandatory' => 1,
        'weight' => 2,
        'pid' => 0,
        'extra' => array(
          'private' => 0,
        ),
      ),
    );
      // etc etc

  webform_ensure_record($node);
  foreach($components as $component) {
    $component['nid'] = $node->nid;
    $component['extra']['title_display'] = 'inline';
    $component['extra']['locked'] = 1;
    $node->webform['components'][] = $component;
    webform_component_insert($component);
  }

  // Retrieves information about the author
  $author = user_load($node->uid);
  // Adds the author of the node as the default email recipient
  $email = array(
    'nid' => $node->nid,
    'email' => $author->mail,
    'subject' => 'default',
    'from_name' => 'default',
    'from_address' => 'default',
    'template' => 'default',
    'excluded_components' => array(),
  );
  webform_email_insert($email);

  $validation = array(
   'validator' => 'max_words',
   'action' => 'add',
   'nid' => $node->nid,
   'rulename' => 'Maximum Abstract Length',
   'rule_components' => array(
     1 => '1',
   ),
   'data' => 300,
  );
  webform_validation_rule_save($validation);

  }

Basically I'm missing the correct notation for how you add a condition to the webform but I have the right command to insert it. Also, I have the notation for how I want to setup my webform settings, but I don't know how to apply it

Many Thanks

EDIT

I've got one half of it, I've managed to add the conditional statement into the code, I was actually using the wrong code, but I managed to find a proper example of how the array needs to be written, edited the code above


texts:
Drupal adds line breaks after a width of 77 in the function wrapMailLine() of the class core/lib/Drupal/Core/Mail/MailFormatHelper.php.

What is the reason for that?

If you open the mail in a small viewport like on a phone, e.g. the line breaks after 50 chars and then again after 27 chars. This behavior is undesired.


texts:
For example, here's a snippet form the Comments Module (comment.module):

function comment_menu() {
  $items['comment/%'] = array(
    'title' => 'Comment permalink',
    'page callback' => 'comment_permalink',
    'page arguments' => array(1),
    'access arguments' => array('access comments'),
  );
  $items['comment/reply/%node'] = array(
    'title' => 'Add new comment',
    'page callback' => 'comment_reply',
    'page arguments' => array(2),
    'access callback' => 'node_access',
    'access arguments' => array('view', 2),
    'file' => 'comment.pages.inc',
  );

  return $items;
}

How can I override $items['comment/%'] with $items['comment/reply/%node'], without hacking core.

In other words, I need example.com/comment/[cid] to look exactly like example.com/comment/reply/[nid]/[cid]?


texts:
I'm using Bxslider which required jquery 1.8 to be responsive. However, when using jquery 1.8 I get errors with views when trying assign and change values.

How should I solve this problem?


texts: Show a Custom Block on Homepage in Drupal 6

texts:
I am trying to show a simple block on my home page in Drupal 6.

The Drupal has simple HTML Text.

My question is that how can I show it in my code in let's say Page.TPL.PHP

I searched Internet and tried this:-

 if (drupal_is_front_page()) {

      // $block = block_load('block',314);
      // $output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block))));
      // print $output;

      $block = module_invoke('user', 'block', 'view', '314');
      print $block['content'];

The block num is 314 but other than that I am not sure that what user, block or view means in the function. I want to show it on the home page, hence I put it in a condition.

Do I have to leave it disabled or should I enable it in some region so that it can be shown on the Home Page?

Thanksa lot.


texts:
I am building a restaurant application which would have a search functionality, and when somebody searches of restaurants for a zip code, it would return the data. The data would be the name of the restaurant, the description and the map. When a user is adding the restaurant, I am using address field and geofield to get the latitude and longitude, so getting the maps up and running isn't an issue now.

However, I trying to create the search view, but I am unable to create a view which has a path, and which would display the title, description and then the map.

ex: Title | Description
    MAP1(map for first restaurant)

    Title | Description
    MAP2

Can somebody tell me how would I build it?

The modules I am using to build this are geofield, geophp, geocoder, addressfield, openlayers, views, ctools and libraries.


texts: Drush won't clear uploaded temporary files

texts:
So, working on a unix system, it's common that /tmp has the sticky bit set (i.e. only the owner of the temporary file can write/delete it). This is an issue when running drush cron.

If I upload a file, and the file gets stored in /tmp, then the owner is _www (I'm on a MacOS machine). When I run drush, I'm running it as my own user, so if I run drush cron then my user is attempting to delete the temporary file(s) that was uploaded, and I get a permission denied.

Can anyone think of a simple workaround for this problem?


texts: Adding rel=canonical meta tag in comment paginated node pages in Drupal 7

texts:
This question is same as that of Drupal 6 question: Adding rel=canonical meta tag in comment paginated node pages but for Drupal 7.

How can I add rel=canonical tag in the paged urls ( like ?page=1) pointing to the main version one?

I could find the feature in the Nodewords module in Drupal 6. But the Metatag counterpart in Drupal 7 does not seem to have any such option.


texts:
Is it possible to put multiple forms on a single page?

I am trying to make a coupon offer page. I wanted to have two forms for two different offers on each side of a page. Each form has a text field for the coupon code and its own submit button. The first form works okay; however the second form's hidden values seem to be overridden by the first form's.

I'm using hook_alter to alter the second form to make it different, but it still has the same form_id as the first. Is this what's causing my problems, or do I need to look/think somewhere else?

The two forms have the same values for "form_id" and "form_token," but different values for "form_build_id."


texts: How do I create a view from the user interface, and get the code to create it programmatically?

texts:
Is there a way to get the program code for creating a view from an existing view?

I first created a dummy view with the user interface. I would like to get the code that I have to insert in my module to create that view, so that my module replicates what I did with the UI. Is this possible?


texts:
I'm using ubercart for a poster printing process. It allows users to upload files for poster printing.
But in the order page where I can see the summary of the order, the section for Upload File displays as Upload File: Array instead of a link to the uploaded file.

Has anyone run into this problem before, or someone can point me to the module file that generates this section?

NOTE: The files are uploaded correctly, I can see them stored in the file directory.

Thanks


texts: Grouped exposed filters just don't work on tags

texts:
So I created a nice gallery view and I wanted to add an exposed filter on tags so that my users could filter the content in it.

I created the proper tags ("photo" and "video" for example), created my tags filter using the "autocomplete" setting, checked the "Expose this filter" combobox and checked the "Grouped filters" radio.

Then, I added my two corresponding rows, giving them the respective values "is one of" => "photo" and "is one of" => "video", and left the default row to "Any". I have two nodes containing the tags "photo" for one, and "video" for the other.

Yet when I save everything and go to my gallery view, not only do I not get anything displayed even on the "any" filter, I get this error message:

Unable to find term: all

When I try to use my filters I don't get anymore things, but these messages:

Unable to find term: 1

Unable to find term: 2

These numbers are written in the "?field_tags_tid=" of my URL when I click my exposed filter buttons, but they are not even the corresponding tids of my two tags: "photo" is 11 and "video" is 12...

Even weirder: when on the admin side I change settings of my tags filter to "Dropdown" instead of "Autocomplete", this time I DO get the correct content displayed on my view for the "any" filter, but still nothing for the "Photos" and "Videos" filter, which still point to "?field_tags_tid=1" and "?field_tags_tid=2". But this time, no errors displayed.

Sadly, I cannot even try to put the right tid in my URL. I get the following error:

An illegal choice has been detected. Please contact the site administrator.

Is this drupal thing completely broken or am I just terribly unlucky?


texts: How can I exclude the link for the current page when I have a list of links in Views?

texts:
I'm using Drupal 7 with Panels and Views.

I've configured a view to list several links to different panels.  This view is displayed as a content pane on each of the respective panels to allow for easy navigation.  However, this means that the link to each page is shown on that page as a link, which is unsightly and confusing.

Within Views, is there a way to configure the filters, etc. to hide or (best case) rewrite the link so that it is shown as plaintext rather than a link if it is pointing to the page being shown?


texts:
I'm trying to display a menu in my module. I've used \Drupal::entityManager()->getStorage('menu')->load('oz-topbar-menu'); which allows me to get the title of the menu, the description, etc.

I obviously need the links of that menu, and I can't understand how to retrieve. From what I've read in the documentation I should probably use MenuLinkTreeInterface but I don't understand how to instantiate it.

I've tried \Drupal::menuTree()->load('oz-topbar-menu', $menu_parameters);. With basic menu parameters it returns a humongous amount of information; I'm guessing it must be the entire menu tree of Drupal.

I tried playing with the parameters of MenuTreeParameters (setTopLevelOnly, setRoot('oz-topbar-menu')) but it returns an empty array.

I've tried sending this as a MenuTreeParameters object with \Drupal::menuTree()->getCurrentRouteMenuTreeParameters('oz-topbar-menu'), but I still get a massive link tree.


texts: Is it possible to align (left or right) teaser images that are uploaded through Imagefield in Drupal 7? Is there a clean solution whithout hacking into drupal code?


texts:
Background:
Created a custom views block to use unformatted view showing fields set under 'Format'.
Also, created an override template as views-view-fields--bookstheme--block.html.twig and then created the HTML structure within this custom template and then I am simply printing the field like for example Eg:- {{ fields.booktitle.content}}

Below is attempt within to get the image field URL.

Observation:
Solution Attempt #1 worked for me and Solution Attempt #2 didnt. Request help on what I missed out.

Solution Attempt #1:  [ Works ]

{# Below image field from view o/p #}
{{ fields.field_books_theme_pic.content }}
{# Creating a Field URI post setting up relationship to image field fields.uri.content gives uri format eg:- public://image.jpg #}
{{ fields.uri.content|striptags|trim }}
{# and this gives the image uri for src ref #}
{{ file_url(fields.uri.content|striptags|trim) }}

Solution Attempt #2  [ Something missing, no output ]

{% set url = fields.field_books_theme_pic.content|render|striptags %}
{{ url }}


texts: Drupal Coding D7 - Taxonomy - How do I establish the hierarchy and associated fields for taxonomy terms?

texts:
Reviewing the code in Taxonomy.module I determined the array to define a taxonomy terms as:

 'taxonomy_term' => array(
      'label' => t('Taxonomy term'),
      'controller class' => 'TaxonomyTermController',
      'base table' => 'taxonomy_term_data',
      'uri callback' => 'taxonomy_term_uri',
      'fieldable' => TRUE,
      'entity keys' => array(
        'id' => 'tid',
        'bundle' => 'vocabulary_machine_name',
        'label' => 'name',
      ),
      'bundle keys' => array(
        'bundle' => 'machine_name',
      ),
      'bundles' => array(),
      'view modes' => array(
        // @todo View mode for display as a field (when attached to nodes etc).
        'full' => array(
          'label' => t('Taxonomy term page'),
          'custom settings' => FALSE,

Assigning the correct info in the array and calling taxonomy_save_term($term); creates the term, but I have not unearthed the method or array fields necessary to define the hierarchy and attach data fields.

Are there additional array key/values to identify the parent/children and fields?

Are the fields attached to a term in a separate operation after the term is created?

What array keys are required to create the term?


texts: Exclude core and Boost module tests execution

texts:
I am getting more and more into phpunit testing and have copied the core/phpunit.xml.dist file to core/phpunit.xml.

Exclude anything from core

I would like to exclude anything from the core, so phpunit has to find only my module's tests in modules/custom, but when I use vendor/bin/phpunit -c core --list-groups it still finds any module and test of the core.

Boost execution

Another problem I have is the execution of some very simple tests inside the test_example module with vendor/bin/phpunit -c core --group test_example takes ages.

How do I accelerate the test execution?
Have I configured it wrongly?

This is the content of the phpunit.xml file.

<?xml version="1.0" encoding="UTF-8"?>

  <!-- TODO set checkForUnintentionallyCoveredCode="true" once https://www.drupal.org/node/2626832 is resolved. -->
  <!-- PHPUnit expects functional tests to be run with either a privileged user
   or your current system user. See core/tests/README.md and
   https://www.drupal.org/node/2116263 for details.
  -->
  <phpunit bootstrap="tests/bootstrap.php" colors="true"
           beStrictAboutTestsThatDoNotTestAnything="true"
           beStrictAboutOutputDuringTests="true"
           beStrictAboutChangesToGlobalState="true"
           checkForUnintentionallyCoveredCode="false">
  <!-- TODO set printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter" once
   https://youtrack.jetbrains.com/issue/WI-24808 is resolved. Drupal provides a
   result printer that links to the html output results for functional tests.
   Unfortunately, this breaks the output of PHPStorm's PHPUnit runner. However, if
   using the command line you can add
   - -printer="\Drupal\Tests\Listeners\HtmlOutputPrinter" to use it (note there
   should be no spaces between the hyphens).
  -->
    <php>
      <!-- Set error reporting to E_ALL. -->
      <ini name="error_reporting" value="32767"/>
      <!-- Do not limit the amount of memory tests take to run. -->
      <ini name="memory_limit" value="-1"/>
      <!-- Example SIMPLETEST_BASE_URL value: http://localhost -->
      <env name="SIMPLETEST_BASE_URL" value=""/>
      <!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/databasename#table_prefix -->
      <env name="SIMPLETEST_DB" value=""/>
      <!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output -->
      <env name="BROWSERTEST_OUTPUT_DIRECTORY" value=""/>
    </php>
    <testsuites>
      <testsuite name="unit">
        <file>./tests/TestSuites/UnitTestSuite.php</file>
      </testsuite>
      <testsuite name="kernel">
        <file>./tests/TestSuites/KernelTestSuite.php</file>
      </testsuite>
      <testsuite name="functional">
        <file>./tests/TestSuites/FunctionalTestSuite.php</file>
      </testsuite>
      <testsuite name="functional-javascript">
        <file>./tests/TestSuites/FunctionalJavascriptTestSuite.php</file>
      </testsuite>
    </testsuites>
    <listeners>
      <listener class="\Drupal\Tests\Listeners\DrupalStandardsListener">
      </listener>
    </listeners>
    <!-- Filter for coverage reports. -->
    <filter>
      <whitelist>
        <directory>../modules/contrib</directory>
        <directory>../modules/custom</directory>
        <!-- By definition test classes have no tests. -->
        <exclude>
          <directory>./includes</directory>
          <directory>./lib</directory>
          <directory>./modules</directory>
          <directory>../sites</directory>
          <directory suffix="Test.php">./</directory>
          <directory suffix="TestBase.php">./</directory>
        </exclude>
       </whitelist>
    </filter>
  </phpunit>


texts: Post to anonymous user's Facebook Wall with rules

texts:
I wonder what is the best way to implement post to User's wall for anonymous users. All solutions I came across seem to require creation of a Drupal User Account (using FB Connect) first.

I need a rules action that automatically asks for permission to post and then posts immediately, without creating a Drupal User Account, fetching any additional information and especially without requiring the user to connect manually in advance.

Thank you for suggestions!


texts:
I have a problem when adding a new field to a content type. The schema installer for the specified field always causes the following error:

  Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL DEFAULT NULL, PRIMARY KEY (entity_type, entity_id, deleted, delta,' at line 12.

Here is the hook_field_schema() implementation:

function google_directions_field_schema($field)
{
    return array(
        'columns' => array(
            'lat' => array(
                'type' => 'float',
                'size' => 'big',
                'not null' => false,
            ),
            'lng' => array(
                'type' => 'float',
                'size' => 'big',
                'not null' => false,
            ),
            'mapTypeId' => array(
                'type' => 'varchar',
                'length' => '15',
                'not null' => false,
            ),
            'zoom' => array(
                'type' => 'integer',
                'size' => 'small',
                'not null' => false,
            ),
        ),
        'indexes' => array(
            'lat_lng' => array('lat', 'lng'),
        ),
    );
}

I hope somebody can point out my mistake here. If some informations missing, please comment.

Thank you in advance.


texts: How do I disable/enable a module on all sites within a multi-site Drupal installation using drush?

texts:
As an admin of a multi-site Drupal installation, I want to make module changes to all sites within that platform.  On a regular basis, I want to disable/enable a set of modules to ensure consistency across all of the sites.

Using drush (any version 4.x, 5.x, or 6.x is acceptable), how can I perform this task without repeating the same command across each site?


texts: Smart Paging: can it work with custom view mode (other than full)?

texts:
Relevant modules: Smart Paging 7.x-2.1 and Display Suite 7.x-2.2.

Pagination works for full view mode but it doesn't work for my custom view mode which I set through hook_entity_view_mode_alter in template.php. I am using a custom view mode for article on another theme.

How can I make Smart Paging work for my custom view mode?

Thanks!


texts: Bootstrap Responsive Wrappers module's Format field won't save using Drupal 8

texts:
I've setup a new style (Configuration / Content Authoring / Text Formats and Editors) in order to use the Bootstrap Responsive Wrappers module for video embeds.

I can apply the Format to text fields during field creation. But after saving if I edit the field again it has reverted back to "basic HTML".

Are there any alternative Modules for successfully allowing fields to responsively embed videos from Youtube within Drupal 8 using Bootstrap 4 based theme?

UPDATE: I Found an alternate solution:
I've started to using this module instead:
https://www.drupal.org/project/video_embed_field

The Video Embed Field module is working responsively now and required little effort to set it up.


texts: Make page.tpl.php and page--front.tpl.php share same html

texts:
Is there a way to make page.tpl.php and page--front.tpl.php share the same template base?

If any of you are familiar with the Twig templating engine, You can define blocks with {% block content %}Node Content{% endblock %} and then do something like:

{% extends 'page.html.twig' %}
{% block content %}Home Page Stuff{% endblock %}

Does PHPTemplate have anything equivalent? I tried using PHP's include() but it doesn't work.


texts: Translate Entity Permission per Content Type

texts:
I'm using Entity Translation and I have a user role that should be able to translate nodes of type article but no other content types:

User A should see the Tabs "View, Edit and Translate" for a node of type article but not on node of type "company".

Within the permissions there is only allow translation or not at all. How can I do this? Right now I'm hiding the tabs in my page.tpl if the content type is "article" and the user role fits, but that is not the same as revoking the permission.


texts: How to add a catch-all wildcard to hook_menu?

texts:
I want a url structure like so:

https://example.com/bob

which loads a custom page for the user bob. This is what I'm trying:

function mymodule_storefront_menu() {

    $items = array();

    // Wildcard catch for user's storefront
    $items['%'] = array(
      'title'           => 'User custom page',
      'type'            => MENU_CALLBACK,
      'page callback'   => 'mymodule_load_user_page',
      'page arguments'  => array(0),
      'access callback' => TRUE,
    );

    return $items;
}

function mymodule_load_user_page($user) {
    echo $user;
}

However, I'm getting a server 404 and drupal is logging a 'page not found' message the the dblog. Any ideas?

Edit:

I am able to get this to work:

$items['u/%'] = array(...);

but would prefer the plain wildcard to work, if possible.


texts: Pathauto for a multilingual site not generating alias for non-default languages

texts:
I have a site with 90% content in Chinese, and only 10% in English.

Thus the requirement of the client is that when viewing an article in English, everything around it remains in Chinese. Blocks, menus etc

a) Enable language prefix

What this does is sets english article with en/[node:title] which is acceptable. But the problem occurs as it appends that to every url in the menu, and other places. So they become like en/categories/CHINESE-CHARACTERS which is not right, and no content is displayed.

In pathauto for English articles, I thus tried, specifically giving it [node:title]. Yet it prepends the en.

b) Disable language prefix.

Now all my links are fine. But the english article is now a node/[nid]. The url aliases just don't seem to be working in this case. If I could just have the URL alias working in this case, things would be great too.

Any solution to my misery is welcome.


texts: How to remove taxonomy term reference field from simplenews newsletter HTML

texts:
I have spent a week watching videos and reading tutorials on how to customize the HTML generated by Simplenews. I'm stuck on how to remove the following from my newsletter. I discovered the following using Firebug. There is a bewildering array of CSS, HTML, and php files that are involved. I'm clueless as to how to find the one that it is control.

Can you tell me how to code CSS in the new theme I created for newsletters to remove the following?

div class="field field-name-field-simplenews-term field-type-taxonomy-term-reference field-label-hidden view-mode-full"ul class="field-items"li class="field-item even"a datatype="" property="rdfs:label skos:prefLabel" typeof="skos:Concept" href="/newsletter/test">test

</div


texts:
I created two languages

English and French

I am facing problem when content is not translated into french by default its displaying english content.

How to display only french content if i select french language


texts: Why doesn't All Products show all my products in Drupal Commerce?

texts:
I've set up a Drupal Commerce site without the sample products, and have created new products in a new product displays that I've created.

I've created Main menu items for the new displays, and the products show up when these menu items are clicked, but All Products shows no products.

How do I make All Products work? Is there a special View for this?


texts: The link/button "Add content set" was disappeared (Drupal6)

texts:
According to the post http://drupal.org/node/907542, It mentioned [Go to Admin > Content Management > Migrate and click on "Add content set"].

However, I can't find the link/button of "Add content set", I have install migrate module to another test server, but not works. Could someone advise how to fix it?

Thanks

Reference:


texts: Is there a module that allows a php text filter in drupal 8? This was a possibility in drupal-7 but I can not find something similar to 8.


texts: How to implement Entity Reference, Objects and CRUD operations?

texts:
I want to create an object, named XML. The XML object has a name(string) and the content itself (in XML format).

CRUD operations should be supported as follows:

I want to make each user able to Create, Update, and Delete instances of the XML object.
These instances can only be seen (Read) by their owner.

I also want to be able to programatically do some actions with the data before they are saved, deleted, etc.

Any advice about how to do so?


texts: Filtering by the entity an EVA field is attached to

texts:
I've got a very nested set of entity reference relationships, and they're all nodes/content types, but each is a different bundle/type. It's something like:

There's a field on Content Type A that points to a Content Type B
There's a field on Content Type B that points to a Content Type C
There's a field on Content Type C that points to a Content Type D

When displaying Content Type D, I want to sort of go backwards and each one higher up is display nested in the one that it points to. So, something like:

Content Type D stuff
_______________________________
| Content Type C stuff        |
| ____________________________|
| | Content Type B stuff      |
| | __________________________|
| | | Content Type A stuff    |
|_|_|_________________________|

Now, there can be many As, Bs and Cs, above is just the simplest. So, something like:

Content Type D stuff
_______________________________
| Content Type C stuff        |
| ____________________________|
| | Content Type B stuff      |
| | __________________________|
| | | Content Type A stuff    |
|_|_|_________________________|
| Content Type C stuff        |
| ____________________________|
| | Content Type B stuff      |
| |___________________________|
| | Content Type B stuff      |
| | __________________________|
| | | Content Type A stuff    |
|_|_|_________________________|

I thought of doing this:

D's display will just be the normal node page. Great.
I create a Views block that shows up on D nodes, and does a contextual filter by URL, showing C types as rendered entities. Great.
I created an EVA field, and attached it to C types, that displays B types.... and here's where I hit the problem.

I can traverse my way up through the relationships, and filter by URL like I did with the block view, but that means that every C that the block view displays will display EVERY B that's associated with that D, not just the ones with that particular B->C relationship. I have no idea how to do this.

Is there any way, presumably with the contextual filter, to get the entity information for the entity that the EVA field is attached to?

(If you're wondering why these relationships were built this way, it was a D6->D8 migration, and it was just decided that this would be the quickest path. Please, I'm hoping for a view solution if it exists.)


texts: Exporting from Field Collections and Importing to New Content Type

texts:
So here's a high-level overview of the situation: we're running into a lot of issues with the field collections module, but a lot of content has already been created for a content type that uses two fields within a field collection. We've tried to overcome some of the problems we're experiencing with field collections, and at this point it's been over a month, so we're just going to have to give up on field collection for this project.

So here's what we have. A content type like this:

Title Field
Field Collection field containing:

Subtitle Field
Body Field

And we want to export from that and create nodes in a content type that looks like this:

Title Field
Subtitle Field
Body Field

I don't really need past revisions or anything like that. I'm just looking for advice about how best to accomplish this.


texts:
I am new in Drupal theming and I would like to control the "submitted by" part of a node. I want to remove the name of the author and stylize the created_date of the node. The problem is that I also echo some greek characters that show up in weird symbols in my site. I tried changing the encoding to utf-8 but it won't work. I am not even sure what the original encoding of node.tpl.php is. How would I go inserting my own custom text inside node.tpl.php and printing it correctly?

<?php if ($display_submitted): ?>
  <footer class="submitted"><?php $posted="Δημοσιεύτηκε στις "; echo mb_convert_encoding($posted, "UTF-8", "Windows-1252") . date( "d F, Y",$node->created); ?></footer>
<?php endif; ?>

The code above returns:

  Äçìïóéåýôçêå óôéò 12 January, 2012

I also tried utf8_encode function but that was a long shot since it converts ISO-8859-1 strings to UTF-8.


texts: Can we use Deployment Module with multi DB Drupal Site or Cross DB Connection Drupal Site?

texts:
I have scenario in which I am using Cross DB connection on my Drupal 7 Site, I specified my DB connection in settings.php file. Second DB is used as a source db.

Can I use Deployment Module to deploy updates on my default drupal DB only or can also deploy updates on second DB too?


texts:
On our Drupal 7 social network site, we want the user ID (user number) to start from 5000.
What is the easiest way to do it?


texts: From where comes $scheme argument in image_style_deliver callback?

texts:
In core image.module there is a menu item:

  $directory_path = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath();
  $items[$directory_path . '/styles/%image_style'] = array(
    'title' => 'Generate image style',
    'page callback' => 'image_style_deliver',
    'page arguments' => array(count(explode('/', $directory_path)) + 1),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );

As you can see, there is only one argument passed to it. But when we see "image_style_deliver" function, we see:

function image_style_deliver($style, $scheme) {

I don't know if I'm tired or what but... from where $scheme argument comes from? ;)


texts: How to keep some fields or a content type private

texts:
I have a content type for concerts, and a view for upcoming concerts.

For some of the upcoming concerts, the performer (site owner) wants to list just the date and the venue, but cannot list the title of the performance, because the company has not yet announced the season.

Is there a way to keep part of a node of that content type private, preferable until a specific date has been reached?

I am looking for a secure and foolproof solution, because I don't want to be subject to a lawsuit, in case the information leaks prematurely.

The alternative could always be to create two nodes - one of them published with only the public information, with an expiration date, the second one with the full information, initially unpublished, with an automatic publish date. However, I would like to provide a more comfortable way to input the information - add it only one time and don't worry about it.

So, for the alternative solution - what is the best way to create a node from a node with extracting part of the info of the parent node to the child node? For this scenario, I imagine changing the content type permissions to allow only authenticated users, and creating or updating child nodes in a "public" content type with the allowed subset using something like rules.

Any hints would be greatly appreciated.


texts: drupal 7 PDOException error saying I'm missing a table or view mysite_drupal.cache_views

texts:
The full warning message goes like this: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mysite_drupal.cache_views' doesn't exist: TRUNCATE {cache_views} ; Array ( ) in cache_clear_all() (line 165 of /home/user/mysite.com/includes/cache.inc).
should I try to manually create it?


texts: Can't edit/add a specific content type sometimes - SQL has gone away

texts:
Hi Can anyone help with this situation.

I am on Drupal 7.12 and I am getting a white page (or if I have enabled errors to show, a SQL has gone away error when I try to add or edit a specific content type:

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT rid, permission FROM {role_permission} WHERE rid IN (:fetch_0); Array ( [:fetch_0] => 1 ) in user_role_permissions() (line 752 of /var/www/vhosts/pen.org/staging.pen.org/modules/user/user.module).

This only happens sometimes and when it does lasts a couple of days. And it goes away suddenly. During the time it happens, other content types are editable. The site also functions fine.

Has anyone experienced this before? Any insight is much appreciated.

Thanks.


texts: Drupal combine nodes and comments in view

texts: I have a view with nodes of the type 'Note' (custom CT). I have A view with comments that are associated with those nodes. How can I combine these views into one view so that I can filter them individually on the date ?


texts:
I am trying to install my live drupal (version 8) website in localhost. I have downloaded the files and folders. I have imported the database. And updated settings.php file.

But when I try to log in, after entering username and password, the page redirects to core/install.php and I get this message - "Drupal already installed".

what does this mean? How can I resolve this?


texts: Rules and VBO, data deletion without reason

texts:
I use VBO module to batch assign taxonomy terms with Rule Component. The problem is that the taxonomy term is successfully inserted in all selected nodes BUT it also deletes the data of another field, for an unknown reason. The settings of my rule is:

Variables:
datatype=node,
datatype=Taxonomy term

Conditions:
Entity has field
Parameter: Entity: [node], Field: field_agora_category

Actions:
Set a data value
Parameter: Data: [node:field-agora-category], Value: [term]

I don't use any wrong fields in Rules configuration but it deletes the data of another field (type:Geospatial data).
Is that possible? Is it a bug?

I use:

Drupal    7.18

Rules 7.x-2.2

Views Bulk Operations 7.x-3.1


texts: Deleting modules from the database that aren't on the filesystem

texts:
How do I remove modules that are referenced to in the database but have already been deleted from the filesystem?

This occurred because I had extra modules in my staging site, and I pushed the db to production. I would like to know how to clear out any modules from the db that aren't found on the filesystem.


texts: Use part of the user_profile_form on another page

texts:
My users enter a phone number on registration. The amount of values that can be entered is set to unlimited. Setting this changes the field so that you can add another field below to add additional phone numbers.
I would like the users to be able to add more numbers after registration without having to go to /user/%user/edit

I am trying to return just the phone number field on another page.
However I cannot seem to get any of that form displayed on another page.
When I have been displaying other forms I have called them like this:

drupal_render(drupal_get_form('user_profile_form'));

This does return part of the form, First Name, Last Name, Country (all custom fields) but not the phone number field. I also get quite a few errors
Undefined index: user_profile_form in drupal_retrieve_form()
Undefined index: #user_category in block_form_user_profile_form_alter
Undefined index: #user_category in overlay_form_user_profile_form_alter()
Undefined index: #user_category in system_form_user_profile_form_alter()
Undefined offset: 0 in uc_roles_form_user_profile_form_alter()

Obviously I am doing something very wrong...


texts: What drush version I can use that doesn't require composer?

texts:
I try to use drush on the server that is behind corporate firewall, and downloads from many sites are blocked. In particular, when I run "composer diag", it hangs for the long time on the line "Checking http connectivity to packagist: http://packagist.org/" and then prints "The "http://packagist.org/packages.json" file could not be downloaded: failed to open stream". I saw similar blockage when trying to use wget with a number of URLs, including ftp-origin.drupal.org/files/projects/.

So how far back should I go to get the version of drush that doesn't use composer and will not try to update itself on the first run? I understand that some functionality will be missing, but at least basic functions like "drush cc", "drush en", "drush dis", etc. I will be able to use.


texts: Enabling "entity translation" disables term translation in Drupal (name and description)

texts:
i want to translate taxonomy terms and their description text.
When I enable the module "entity-translation" and check "Taxnomie-terms" in admin/config/regional/entity_translation, the terms and descriptions get synchronized. Means: If I enter the German termname and description and switch to english and change it there, it also changes on the german translation.

The lables show:

Name (all languages)
Description (all languages)

And I don't know how to change that. Ideas for solving my problem welcome!


texts: Adding taxonomies to node gallery and using views to display

texts:
I think the most important piece of information I can give is I am doing a migration from Drupal 6 to Drupal 7 and I am resetting everything up. This gave birth to a few hiccups along the way. As a side note, all content was migrated using the drupal-to-drupal migration module.

I have a few taxonomies. Some of the vocabularies have terms. I am using Node Gallery to create and display galleries and I am also using views to display some views. Given this information, I have 2 problems:

The first is I do not know how to link node gallery to any of the terms. This would be the first thing I need to do. I need to link a gallery to a specific category or term.
The second problem might be a bit involved. I need to create a view, based on the taxonomy accessed. On the Drupal 6 website, the menu URL was say /category/vocabulary/term. When clicked it redirected to ex. /gallery-page/term where both terms are the same.

I know the Drupal 6 site used Taxonomy Views Integrator. Not sure if that was what created it. I haven't had any luck getting any of this to work.

I see the Drupal 6 version allows you to select a category when creating or editing the gallery, not sure if this is a custom module.

Any advice, module suggestions or anything like that would be greatly appreciated.

Update:

I think I have figured out how to set categories, was missing a field. Added it and can now select. Will edit again if fixed.


texts: Can we add the destination query parameter to a link from yml configuration?

texts:
When creating a link from yaml

ie: mymodule.links.action.yml

my_module.my_entity.add:
  route_name: node.add
  title: 'Add My Entity'
  route_parameters:
        node_type: 'my_entity'
  appears_on:
    - my_module.my_entity.admin_content

Is there a way that this links would be generated with the ?destination=path/to/redirect ?


texts:
I get WSOD when I try to access the views page (admin/structure/views).

I get the notice below in the error log followed by the error.

Notice: Undefined index: id in Drupal\Core\Config\Entity\Query\Query->Drupal\Core\Config\Entity\Query\@closure() (line 92 of /home/pierost0/public_html/core/lib/Drupal/Core/Config/Entity/Query/Query.php).

Drupal\Core\Entity\EntityMalformedException: The "view" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\Entity->toUrl() (line 189 of /home/pierost0/public_html/core/lib/Drupal/Core/Entity/Entity.php).

I have disabled all views through Drush but there's seems to be one empty view. Take notice on the screenshot. An empty view is enabled.

Is that view my problem? Where are the views files, or entries in the db so I can have a look for the solution there.


texts: How to programmatically delete a display from a view

texts:
Is it possible to programmatically delete a display from a view?

The view object has numerous member functions related to displays (add_display, attach_displays, choose_display, set_display, new_display, etc.) and I can also disable a display like this:

<?php
  $view_name = "faq";
  $display_name = "page_1";
  $view = views_get_view($view_name);
  $view->display[$display_name]->display_options['enabled'] = FALSE;
  views_save_view($view);
?>

But I can't see how I can remove the display completely. Can anyone advise? Thanks!


texts: How to link to live chat TawkTo module pop up window with Drupal 7?

texts:
I have Tawkto module installed, and I want to create link on my main menu for:

"Live Chat"

The link is:

  <a href="javascript:void(Tawk_API.toggle())"> Click to Chat </a>

Now this works fine on static HTML pages, but when I paste it in field for main menu, it doesn't work.

I've tried:

 /javascript:void(Tawk_API.toggle())

And:

 javascript:void(Tawk_API.toggle())

How can I do this?

The site with Livechat is:

www.vuxi.com


texts: Entity Print Content Modification For Views

texts:
I have a views that I am printing to PDF using Entity Print. The views is a combination of several entities and as such cannot directly utilize the instruction in the "Modify entity content" section of the documentation:

To modify the content of your entity, you
create a twig template using the 'pdf' view mode name (e.g.
node--article--pdf.html.twig). In this template you can modify the
markup as you normally do with other view modes using {{
content.field_example }} or {{ node.field_example }}.

See screenshot of the view:

I tried this twig template suggestion entity-print--views--machine_name--pdf.html and template variables like {{ content.field_bright_news }} (where the name of one of the fields of a referred entity of the view is field_bright_news) but that doesn't seem to work except I may be missing something.
Is the stated instruction in the documentation applicable to views as well or it's solely meant for actual entities. If yes, what is the correct template and variable pattern for this scenario ?


texts: Alter html output of a term reference form field

texts:
On my node edit form a term reference field is rendered with the following html output:

  <input type="radio" id="edit-field-trainingstype-und-12" name="field_trainingstype[und]" value="12" class="form-radio">
  External

As you can see the value attribute is set to 12 which is the term id of that particular item. Now I would like to replace 12 with the term name, External.

So it would look like:

  <input type="radio" id="edit-field-trainingstype-und-12" name="field_trainingstype[und]" value="External" class="form-radio">
  External

I am unsure which function to use to target this particular field.
I was looking at theme_checkbox() and theme_form_element() but I am uncertain how to proceed and if these are the right functions for the job.

UPDATE:
So I would like to show another field based on the option chosen for the field_trainingstype. In a hook_form_alter I am now doing this:

$form['field_organisaton']['#states'] = array(
  'visible' => array(
    ':input[name="field_trainingstype[und]"]' => array('value' => '12'),
  ),
);

But I would like to trigger this by term name External because the term id might differ per environment.


texts:
In Drupal 8, How to load Node and Paragraphs using target_revision_id?
For node I used \Drupal::entityTypeManager()->getStorage('node')->load($nodeId); . I tried this for revision id: \Drupal::entityTypeManager()->getStorage('node')->loadRevision($vid);


texts:
I am populating a new site with my old site's content (i.e copying it) and wanted to make sure all the URLs will be the same. At the momement my old path is name.com/work/sony-folklore and and the new one is: name.building-site.com/content/sony.

NOTE: name.com and name.building-site.com are dummy names that refer to the live and the development version of the site.

What can I change to make the CMS generate the same URLs as they did in the old site?

Thanks


texts: How to add a description to the node title field in form

texts:
In my Drupal 8 project I tried to find a way to add a description to the title field of a node form by hook_form_alter. Following code(s) did not lead to success:

$form['title']['widget'][0]['#description'] =  \Drupal\Core\Field\FieldFilteredMarkup::create('hallo');
$form['title']['widget']['#description'] =  \Drupal\Core\Field\FieldFilteredMarkup::create('hallo');
$form['title']['#description'] =  \Drupal\Core\Field\FieldFilteredMarkup::create('hallo');

What is the correct place to define a description for the node title field?


texts: Should I use contextual filters to limit the view results for each type of administrators?

texts:
I'm trying to display the View according to the current director, example:

I have a content type called faculty news,and I have two faculties: Medicine and Sciences, the content type faculty news is all news of medicine and Sciences.
I have two administrators: admin-medicine and admin-sciences, each one has permissions to publish, read and write only in his faculty.
I have the View: Administrator faculty news
with the path http://example.com/administrator-faculty-news

This view display nodes from content type faculty news.

Now I want to enhance this view like so: when the admin-sciences administrator uses the path http://example.com/administrator-faculty-news, then only the news of the Sciences faculty should be shown in the Views results, and the same for admin-medicine (only show the news of the Medicine faculty).

With contextual filter? How can I do that?

Note: Medicine and Sciences is implemented using taxonomy.


texts: How do I get a field label by the field name?

texts: How do I get a field label by the field name in Drupal 7?


texts: Date field defaults are not shown as values

texts: I have added the date field in the user profile where in i have made the setting as bellow the default value is NOW [it should show the current date], and also the end date default value selected as Relative,and chosen +11 months but when i go and check in the user create page the date field does't showing current date also the end date which has been set to 11 months, please can any one tell me why this is ?it will be great helpful.


texts:
When a user calls the front page of our site we want to check the country from which the user is surfing and redirect the user directly to the country specific front page.

We chose to use the hook_boot() callback to implement this.

Now we have the problem that we want to save the state "is_redirected" into a global variable that will still be available when the redirected page is loading and is calling our hook_boot() again in order to prevent redirect loops.

We thought about using session management, so we loaded the drupal session code with

include_once(DRUPAL_ROOT . '/includes/session.inc');

The question is now, what is the next step after loading session.inc, do we have to call "drupal_session_initialize()", add a custom entry into the superglobal $_SESSION variable and this custom entry + our session will be available after the redirect?

Thank you in advance!


texts: How do I display random nodes within a week?

texts:
I have added Global:Random in Sort Criteria.

It displays nodes that are too old. How could I set the period to 1 week?

The nodes displayed are from last year and year 2013, how to set views to display nodes within a week.


texts:
I installed a fresh D8 and was going for the usual setup of sending code and config to repo, and db sync (from a backup dump or sync from remote). Now when I reproduce the site given the code, config, and dump, I notice that the site has no styles.

Comparing the restored setup and another fresh install, I notice that sites/default/files is missing in the restored setup. This directory is ignored by default because it's supposed to house user generated files. However, a fresh install of D8 appears to put files related to theming in that directory.

So my questions are:

Why is this directory ignored by .gitignore if theme files reside there?
What is the proper way to do this? Should I check-in these files?
What else should I or should not I be checking-in?

And we don't have a common remote environment as of the moment so an "rsync from remote" doesn't apply, nor does checking-in archives as we just want code in the repo.


texts: Taxonomy: Sort Order for Nodes Under Multiple Lists

texts:
I am creating a restaurant menu vocabulary that contains terms and sub-terms. Menu Items (nodes) may be listed under more than one item.

For example Cobb Salad is listed under:

Appetizers >> Salads
Healthy Stuff >> Meals Under 600 Calories

I've tried using the weight module but this isn't effective since it only sets one sort order globally. I need to be able to set the sort order for nodes under each taxonomy term knowing that each node can be associated with multiple terms.

For example, that Cobb Salad might be the top choice under Salads, but the fifth choice under Meals Under 600 Calories.

Any good solutions or combinations of modules that can do this and also allow the site user to easily maintain the menus going forward?

Thanks for your assistance.


texts: How to disable adding new terms via the autocomplete deluxe module for taxonomy terms?

texts: I'm using the autocomplete deluxe module for taxonomy terms in my fields. I want to prevent users from creating new terms during content creation. How can this be done?


texts: I am creating a bash script to automate some stuff including drush commands. When using drush vget I always get Drupal messages, but I only want the value of the variable. This prevents me from correctly using the drush vget output. I already tried with output formats etc. but I always get the messages. How to prevent the Drupal messages to use the output of drush vget in my shell script?


texts: How to get referenced fields of a particular node/content type?

texts:
I have a content type with reference field of type paragraph.

Using below code only gives me fields of content type and does not give referenced fields. How can I get referenced fields of a particular node type?

function hook_form_alter(array &$form, FormStateInterface &$form_state, $form_id) {
    $entityManager = \Drupal::service('entity.manager');
    $fields = $entityManager->getFieldDefinitions('node','media');
}


texts: Is there a way to display current "event" or "show" in date/calendar modules?

texts: I'm building a radio station page with Drupal 7, and I would like to display in a block the current show on air, but I can't find a way to do it. I have installed the Views, Calendar and Date modules, a show content type with the starting date (and hour) and the ending date (and hour too). How show the query and filtering be done in views to display only one show and the one that is currently at the same time as the system time?


texts:
I've been searching everywhere but i do not know how to edit the confirmation email sent when the checkout process is complete.

Where can I edit this?


texts: Drupal 8 webform 8.x-5.8 - how to show the previous step value in next step?

texts:
I have created a multistep webform and it has 5 steps. is it possible to get the previous step field value/data in the next step?
for example, I have a field select list field (key = select_your_data_type) in step 4 and on step 5 show the selected field value?


texts: How do I access the value of a node reference field from PHP code used in a view contextual filter?

texts:
How do I return the value of a node reference field via PHP code in a view contextual filter?

I am attempting to do so via the following steps:

Adding the node reference field in the contextual filters area
Selecting "PHP Code" under "Provide default value"

I get stuck here because none of the data items provided by the Views module ($view and $argument) give access to the data saved in the node reference field.

In Drupal 6, the Views module gives access to a $data variable which contains CCK data saved in nodes, but it seems there is nothing like that in Drupal 7.


texts:
I'm creating a image upload input field in blockForm which will output to Twig later. But got stuck due to some stuff.

public function blockForm($form, FormStateInterface $form_state){
        $form['image_file'] = [
            '#type' => 'managed_file',
            '#title' => $this->t('Upload Your Image'),
            '#default_value' => (isset($this->configuration['image_file']) ? $this->configuration['image_file'] : ""),
            '#weight' => '1',
            '#upload_location' => 'public://',
            '#upload_validators' => [
                'file_validate_extensions' => ['gif png jpg jpeg'],
            ],
        ];

       return $form;
    }

First thing is the '#upload_location', there are a lot of different answer online and the only difference is the path after public://, so I want to know what should I actually deal with it.

Second is the use, is there something missing or it is enough for achieve my goal.

The code I have now:

use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormBuilder;
use Drupal\Core\Link;
use Drupal\image\Entity\ImageStyle;
use Drupal\paragraphs\Entity\Paragraph;

Hope someone can answer and help. Many Thanks.


texts: How do I use user_save() to add a new category?

texts:
In Drupal 7,  there is user_save($account, $edit = array(), $category = 'account'). How do I create a new category for an existing account in Drupal 8?

Also, $user = \Drupal::currentUser(); and $user->save(); gives error as well. I need to attach a form element value to user object.

How to link a login form element to user account on logging in?


texts:
Since a couple of days now, i switched from a ubuntu machine to a macbook pro retina for my development works.

I installed XAMPP on it, without to much trouble.
But I have been struggeling with drush for quite some time now, and I am hoping to find a little help here.

Drush partially works...
I can download Drupal, download modules etc.
I CANNOT enable the modules, perform sql-cli commands (however sql-connect DOES work?!).

The error i get is:

Command pm-enable needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command.                                           [error]
The drush command 'en token' could not be executed.                                                                                [error]
Drush was not able to start (bootstrap) the Drupal database.                                                                                [error]
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database setup by specifying the URI to use with
the --uri parameter on the command line. See `drush topic docs-aliases` for details.
 * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.

Drush was attempting to connect to:
 Drupal version         :  7.28
 Site URI               :  http:// default
 Database driver        :  mysql
 Database hostname      :  localhost
 Database username      :  root
 Database name          :  drupal_site
 PHP executable         :  /usr/bin/php
 PHP configuration      :  /Users/myusername/drush/php.ini /Users/myusername/drush/php.ini
 PHP OS                 :  Darwin
 Drush version          :  7.0-dev
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Applications/XAMPP/htdocs/drupal_site
 Site path              :  sites/default

Now I have been googling around for this for days and found numerous topics, stating all kinds of things (change your settings.php file to use 127.0.0.1 instead of localhost => did not work)

One thing i would like to add is that i discovered that my OS runs a different php version as the XAMPP instance?!

Ps: My drupal_site is fully functional! Just drush won't work with me.

Any help would be very much appreciated!

Best,


texts: Can you create a tpl based on view page url? (Drupal 7)

texts: There's a view page which takes in taxonomy terms to display related content topic/Easter, where Easter is the term. Now in this example, I would like to create a separate TPL for that page topic/Easter. Is that possible?


texts: Trying to remove options form an exposed filter

texts:
In drupal 7, I'm trying to remove an exposed taxonomy filter. This taxonomy filter has a depth of 2. I'm only trying to expose the parent item.

As a quick fix I'm trying (poorly) to remove them with the following theme function below.

<?php
function theme_preprocess_views_exposed_form(&$vars, $hook) {

    //  views-exposed-form-instructor-profile-list-page
    switch($vars['form']['#id']) {

        // instructor profile
        case 'views-exposed-form-instructor-profile-list-page':
            foreach ($vars['form']['term_node_tid_depth']['#options'] as $option) {
                foreach ($option->option as $key=>$v) {
                        if (stristr($v, '-')) {
                            print $v . '<br>';
                            $vars['form']['term_node_tid_depth']['#options']['option'][$key] = 'FILTERED';
                        }
                }
            }

            print_r($vars['form']['term_node_tid_depth']['#options']['option']);
            break;

        // do nothing
        default:

    }
}

In the end I'm trying to figure out what exactly to unset() any option that begins with '- child item'.


texts:
I have a content type "consultation" that has an inline entity reference to 1 node of a content type "prescription". This content type prescription has multiple inline entity references to the content type "medecine".

I'm using the module Inline Entity Form so I create/add all of these nodes in the creation form of "consultation".

I'm trying to change the text "Add new node" in the form to something else. I know how to do this when it's a direct entity reference, but how do I get to the "Add new medecine" for "medecine"?

This is my code so far:

function node_change_form_alter(&$form, $form_state, $form_id) {
switch ($form_id) {
case 'consultation_node_form':
  $form['field_prescription_med']['und']['actions']['ief_add']['#value'] = t('Add new medecine');
  $form['field_prescription_med']['und']['form']['#title'] = t('Add new medecine');
  $form['field_prescription_med']['und']['form']['actions']['ief_add_save']['#value'] = t('Add new medecine');
  break;
}}

In this code:

field_prescription is the name of the entity reference field in "consultation" (to a "prescription")
field_prescription_med is the name of the entity reference field in "prescription" (to "medecine")


texts: Why is my view not running through hook_views_pre_render or theme_preprocess_views_view?

texts:
I am trying to modify a view before its rendered. I have a page with two view blocks on it. I have the following code in my template.php:

function isn3_preprocess_views_view (&$vars) {
  drupal_set_message('Hey', 'status');
  dpm($vars);
}

function isn3_views_pre_render(&$view) {
  drupal_set_message('Ho', 'status');
  dpm($view);
}

However when I visit the page, each function only gets called once, despite there being two views on the page. Is there any reason that a view wouldn't run through either of those functions?


texts: Implement boolean search in apache solr search

texts:
I am working on Apache solr search. I want to implement boolean search in apache solr search.

On  google i found following article and many more articles.

I have also seen the hook_apachesolr_query_alter but i have no idea how to implement the apache solr alter function.

If any one have prior information how to implement it, please guide me to achieve it


texts: How can I construct a table view with columns passed as a parameter?

texts:
I have a content type, referenced by multiple subsequent content types and at some point I made a spreadsheet with all that data. My new assignment is to display a view like that and then export it to Excel, but before that let the user choose which columns appear in the table. I'm also going to need to be able to display exposed filters for all the chosen columns and save the columns and the filters as a report template.

Is it possible to do all that using Views or perhaps create it from scratch as a new entity?

I've been trying to do that in Views and I've hit a few walls. I thought about creating a bunch of PHP fields for all possible columns and check if they should be displayed based on the list of columns to display. Displaying data that way worked, but I can't put filters on PHP fields so I pretty much can't use them here.

After that I tried simply displaying all the columns initially and then in the "modify output" part of the fields display an empty string if that column is not on the list of columns to display (this way I could simply hide the empty columns). Only to realize you can't put PHP code anywhere in the view field settings.

Haven't managed to get that far but I think you can't simply display a node and x referencing nodes in one table row.
How it works in my db is that there's a "Examination" content type, which has different types. Multiple examinations might reference the same node so I'd have to find a way to display that node and all referencing examination types in the same row. Assuming each type can occur once.

^ This part might deserve it's own question though.

To put it shortly: I need to populate table view columns based on a list of columns while still being able to expose full filters to each column


texts: How to flag a product variation on a commerce website?

texts: My products have multiple variations as enitities (size, color etc). I want to display a flag link on a product display page. When a visitor uses it, I want them to be able to flag the selected variation, not the node. Is it possible? Here is a related discussion on drupal.org: http://drupal.org/node/1050872


texts:
I have a bespoke media type that I'd like to index with solr. If I add a new field to an existing Media Type, I can add that field to the solr search using the interface found at admin/config/search/search-api/index/default_solr_index/fields

Fields from my Media Type do not show up on this list. Anyone have any idea why?


texts:
I am working on a theme with a designer.

A Drupal theme typically stores a style.css on file system which can be access via SFTP, which may not be an easy interface for a designer.

Is it possible to provide a editable theme CSS for designer (something like editing style.css in Wordpress)?


texts: What's the best way to allow a user to save variables/options

texts:
I have a user who wanted to save some configuration options for his site. I had initially created a content type of Options, then created a node for that user so they could edit it, and didn't allow them to delete or create any other nodes of this content type. But it feels like this isn't what content creation was created for!
Am I missing a trick in allowing users to save options, or should I just create a custom form and save it to db?


texts: How do I remove the "submitted by" text on node display?

texts: In Drupal 6 the option to remove that text  was located in the theme settings; where is it in Drupal 7?


texts: When offloading a hook implementation to another function, which function should be documented as "Implements..."?

texts:
This is a (probably super simple) document standards-related question.

Example:

_menu_block_block_configure - DrupalContrib

Note the docs: "Implements hook_block_configure()."

It initially threw me off to see an internal function (with underscore prefix) documented as a hook implementation, but if the actual work is being done here then there is some sense to it.

My question: is this the proper way to document it?


texts: Page title not being rendered after page refresh (possible cache issue)

texts:
This is the problem at hand: the first time I access a page after a cache rebuild, the title of said page is displayed correctly. But when I refresh (or access it later after navigating other pages) the title completely dissappears.

My page-title.html.twig is as follows

    {% if title %}

{{ title }}

    {% endif %}

and it doesn't pass the condition check.

If I debug with a breakpoint in HOOK_preprocess_page_title() I see that the title is null. But if I debug HOOK_preprocess_page() the title has the correct markup. So it would seem that somewhere in between those two hooks, the title is somehow being deleted/ignored.

Any ideas on why this is happening or where I could look for further debugging?

I'm currently using this workaround (included in case anyone else is looking for a solution to this problem)

    function HOOK_preprocess_page_title(&$variables) {
      if (is_null($variables['title'])) {
        $request = \Drupal::request();
        $route_match = \Drupal::routeMatch();
        if (isset($request) && isset($route_match)) {
          $title = \Drupal::service('title_resolver')->getTitle($request, $route_match->getRouteObject());
          if(!empty($title)) {
            $variables['title'] = Drupal\Core\Render\Markup::create('' . Html::escape($title) . '');
          }
        }
      }
    }

but I would rather find the root cause for this behaviour and fix it.


texts: Which Rules condition can be used to email a user when an admin updates their profile?

texts:
I am trying to set up a rule (using the Rules module) that will email a user if their user record has been updated by an admin.

It is easy to generate an email when their profile is updated, but I can't see any way to make a Rules condition that the logged in user has a specific role.


texts:
I am using Media Library from core, but users can choose media from any user.
How can I show own content only?
I have tried adding contextual filter in View, but when I change among grid and table mode in Media Library, all content is showed again.
Thanks.


texts: How to get a Drupal 7 Services 3 custom resource to fire

texts:
I have a service endpoint defined in a custom module, as well as a custom resource. They both appear in the Services admin pages, with the resource and its operation checked.

When I hit http://localhost/myservice/myresource?myparm=1, I do not make it to the callback for the resource, but do not receive an error message. The log output shows:

Location    http://localhost/myservice/myresource?myparam=1
Message
Server info main object:

stdClass Object
(
    [module] => rest_server
    [endpoint] => myservice
    [endpoint_path] => myservice
    [debug] => 1
    [settings] => Array
    (
    )

)

Which seems to indicate that it is only recognizing the endpoint and not the resource portion of the path.

The defining code is as follows:

function my_feed_ctools_plugin_api($owner, $api) {
  if ($owner == 'services' && $api == 'services') {
    return array(
      'version' => 3,
      'file' => 'my_feed.services.inc', // Optional parameter to indicate the file name to load.
      'path' => drupal_get_path('module', 'my_feed'),
    );
  }
}

function my_feed_services_resources() {
  $my_resource = array(
    'myresource' => array(
      'retrieve' => array(
        'file' => array('type' => 'inc', 'module' => 'my_feed', 'name' => 'my_feed.services'),
        'callback' => '_myresource_retrieve',
        'help' => 'Lorem ipsum.',
        'args' => array(
          array(
            'name' => 'myparm',
            'optional' => TRUE,
            'source' => array('param'),
            'type' => 'string',
            'description' => 'Lorem ipsum',
          ),
        ),
      ),
    ),
  );

  return $my_resource;
}

function my_feed_default_services_endpoint() {
    $endpoint = new stdClass();
    $endpoint->disabled = FALSE;
    $endpoint->api_version = 3;
    $endpoint->name = 'myservice';
    $endpoint->server = 'rest_server';
    $endpoint->path = 'myservice';
    $endpoint->authentication = array();
    $endpoint->server_settings = array();
    $endpoint->resources = array(
      'myresource' => array(
        'operations' => array(
          'retrieve' => array(
            'enabled' => '1',
          ),
        ),
      ),
    );
    $endpoint->debug = 1;

    return array($endpoint);
  }

and in my_feed.services.inc

function _myresource_retrieve($args) {
  print "args=" . print_r($args,1);
}


texts: Drupal 7: Article with Multiple Image Thumbnails Embedded in it

texts:
I'm using Drupal 7. Whats the best way to create an article with multiple images embedded at various places in the article.

The way I wish to do is that insert image thumbnails and then click it to open the full version in the lightbox or something. How do I achieve this.

Thanks,


texts: What's the difference between drupalSettings and settings parameter in behaviors?

texts:
When having the need to pass settings or parameters from PHP to JavaScript, i always used to do so according to a blog post from Acquia - create a dependency to drupalSettings, attach the settings on the PHP side and use the drupalSettings variable on the JS side.

my_module.libraries.yml:

my_lib:
  version: 1.x
  js:
    js/my_javascript.js: {}
  dependencies:
    - core/jquery
    - core/drupalSettings

my_module.module:

function my_module_page_attachments(&$attachments) {
    $attachments['#attached']['drupalSettings']['my_module']['my_property'] = 'abc';
}

Finally my_javascript.js:

(function ($,Drupal,drupalSettings) {
  Drupal.behaviors.test = {
    attach: function(context,settings) {
      console.log(drupalSettings.my_module.my_property); // would output 'abc';
    }
  }
})(jQuery,Drupal,drupalSettings);

However, I came to a sudden realization that the settings variable of my attach function already contains exactly the same variable:

(function ($,Drupal) {
  Drupal.behaviors.test = {
    attach: function(context,settings) {
      console.log(settings.my_module.my_property); // would also output 'abc';
    }
  }
})(jQuery,Drupal);

So why is there even a separate way to load drupalSettings and it's proposed in every guide I found, when in fact we already have a variable containing our settings, so we don't need to mention the global drupalSettings variable?

Thanks for your clarification!

Update 1

I found out in my test behavior that the variable settings is a reference to drupalSettings, so if you modify one of the two, the other also has the direct changes, and they are therefore equal.

Drupal.behaviors.anotherTest = {
  attach: function(context,settings) {
    console.log(settings == drupalSettings); // outputs true
    drupalSettings.testproperty = 'abc';
    console.log(settings == drupalSettings); // still true
    console.log(settings.testproperty); //  outputs 'abc'
    // works also the other way around
    settings.testproperty = 'def';
    console.log(drupalSettings.testproperty); // outputs 'def' now
  }
}

This applies to every call of my behavior. On my rather complex project, the behavior gets called 12 times, and while the context variable changes on every call, settings is always equal to drupalSettings.


texts: How to assign a user to administer one content type only?

texts:
I have created a content type "TestContent". I created view using the content type. I can add content using the TestContent and I can see the content just fine in view. And I am the admin. Now, I have created a role "David" and I have created a user "xpress". I also have assigned the user to the role.

Then in Admin > People > Permission: I have selected check box for 'David' for the below items:

David: TestContent: Create new content
David: TestContent: Edit own content
David: TestContent: Edit any content
David: TestContent: Delete own content
David: TestContent: Delete any content

I logged out as admin and logged back in as xpress but I did not see the add content, find content for the content type that he has permission. Note that this user only have the permission to add content, edit content, update content, delete content for the content type.

Can you please help?

Thanks.


texts:
I use a computed field, to calculate and store a floating value for a node. Now I want to work with this value in a twig template. When I access the field value via {{ content.computed_field.0 }}it outputs the correct value, say 0.22. When I try to calculate with this value, i.e. {% set newvalue = content.computed_field.0 * 100 %} the page breaks (just pre-calculation twig content is outputted).

My first guess was that, for some reason, the field value is stored or read as a string (or another type?!). My DB says its a float and I don't know how to check a variable type in twig.

I tried to to use twigs number_format()-function : {{ content.computed_field.0|number_format(2) }}. This transforms the computed field to 1. I have no clue why this happens.
What am I doing wrong? Any tips or a workaround?

I use Drupal 8, Twig 1.25, and Computed Field 8.x-2.0-alpha3

Thank you in advance


texts: Feeds import - Skip importing item based on some condition

texts:
I am making API call to import data into Drupal. The API provides 2 filters by which I can get the data. Now I want to apply additional filter on the returned data and only save data which validate the third filter.
E.g.
The API - http://example.com/users?country=US&state=NY
Requirement - I want to import users data into Drupal only if users age is above 18 (And from US-NYC).

Now the API do not have age filter, but it provides age in the response. How can I write a code to ask feed importer to skip import if age is below 18.

Hope I am clear asking this question.


texts: Where can I locate source code of Drupal 1.0 or earlier version?

texts: As for learning purposes, as I am developing my own micro-CMS (well, in fact a femto-CMS) in PHP + MySQL, I would like to locate the earliest possible version of the source code of Drupal. In Drupal.org I can only locate from version 4.x and above, I would like to find 1.0 or even an earlier beta version.


texts:
There is a lot of questions how to check the current user is logged in, but I need to check another users (by uid for example).
Is there any easy way to do it?


texts: How to link a field to node title in view

texts:
I created a content type. I have three fields: title, body, city.

I added two contents.

I can see nodes at:

http://www.example.com/?q=content/we-buy-houses-nj

http://www.example.com/?q=content/we-buy-houses-va

I created a view as following:
I added title field first (excluded from display).
I selected city field. For rewrite results, change the path to "content/[title]"

Result:

I can see the city field is hyperlinked. When I click each link, I get URL as following and page can not be found:

http://www.example.com/?q=content/We%20Buy%20Houses

http://www.example.com/?q=content/We%20Buy%20Houses

How do I remove the %20 so page can be found in my case?


texts: Search a content type fields based on user inputs

texts:
I am using Drupal 7.
I need to create a search condition to generate a search result.I have a content type called "properties".It contains around 20 fields like Location,City,Availability,Property type,Category,Price,Nearby Landmarks,amenities etc...

I have a search form to search properties based on
PropertyCategory
PropertyType
City
Location
Price
Furnish  etc...

But drupal generates separate tables for each field type.How can i retrieve data from all table based on any search condition?I have created a view based on this content type "properties".

Do we have any option to generate a single table for a content type?
Could you please give me an idea.
Please help me ,i am stuck on the way and can't move without any help.

Thanks in advance!

harikris.


texts:
I'm looking for solution to group multiple nodes in to one publication. Idea here is to publish nodes as once like in online magazine as publication.

I did found EPublish module but it is not ported to D7 and not maintained anymore.

What kind of ways there is to control multiple nodes and their publish time/date and also possiblity to treat them as one publication so maintaining and making new publication is simple?

I know this is a bit broad question but I'm searching for the right way to go with this since I dont have clear idea how to implement publication functionality.


texts: Have can I have a view grouped by nested hierarchy?

texts:
I have a nested taxonomy as follows:

Some forms will only have the taxonomy of "Basic Forms", some will have taxonomy of "overtime forms", etc.
So I want my Forms view to look like this example:

How can I get my view to recognize my nested taxonomy?

EDIT TO ADD:
I have made some progress and what I have is repeating the parent taxonomy:

Forms_IT is the parent term-I'd like to start at the next one but can't seem to figure that part out either.

General & Quincy are on the same level.  OT Approval is a subcategory to General but it is not appearing as such and it is repeating the parent and child taxonomy when it lists out the nodes.

This is how I want it:

Any ideas on this?  Is it simply a sorting issue?

7/25 - Edited again to add a pic of my setup and group by.


texts: Custom Javascript doesnt work unless JQuery is set to Default jQuery Version

texts:
I spent the entire day trying to figure out why my custom JavaScript was not working.

Eventually I stumbled into the JQuery Update configuration and set it so that the JQuery that I use for my site was the "default (provided by Drupal)" setting and then it worked. Before it was set to 1.7 jQuery version. Looks like someone set it to 1.7 perhaps for magnific.js because that is now spitting out errors in my console "TypeError: a.off is not a function." Not sure what we use that js file for, but I find it strange that I never found anything on line about this being a potential issue when I was trying to troubleshoot my custom javascript.

Does anyone know anything about this? or am I just in left field? I know it wasn't the same issue the gentleman had in this post.

My custom code was not complex and it never worked. So I reduced it all down to just console out a simple message. But that proved to not work either. My simple console out code for my pulsing.js is:  (function ($) {
  Drupal.behaviors.notWorking = {
    attach: function () {
      console.log("finally is working");
    }
  };
}(jQuery));

Ill just show the screen shots. The first one is the image where my custom code doesnt work because of jQuery update settings as I said above.

The second one is what makes my custom code actually work - but like I said magnify.js then breaks - which maybe i'll hack at it or look for a newer version or something.


texts: How to create Embedded Media Field: Video with custom resolution per Views field

texts: Is there a way to apply a custom resolution to an Embedded Media Field: Video at the time of building a View? Alternatively, a way to define more than the just the Full / Preview presets?


texts: How to get the value of an item from a list field to add it to a computed field

texts:
I am on Drupal 7 and I have issue. I want to set a token system that will make people buy token from their user account settings in order to be able to do some particular actions on the site.

So I've created three fields in the user's form with the help of Display Suite:

field_buy_tickets (Yes/No) : Yes if the user wants to add more tickets. If "Yes", field "field_nb_of_tickets" appears.
field_nb_of_tickets : is a list of numbers from 1 to 9 that the user choose one item.
field_avoir : When the user Save the changes, the number in the item chosen in "field_nb_of_tickets" should be added to the this field_avoir. I chose this field to be "computed" because I want the new value to be added to the old one, not to override it.

I was sure that it would work well, but I get an error. After a few time trying to make it work, I am still at the same point.

Can somebody help ?

Here are some pictures to illustration the case:

1. The first 2 fields

2. The third field

3. The field_avoir settings

4. The error

Thank you.


texts:
I'm trying to override the default page template for a specific page I created. I created a new page and then created a new template file called page--node--1.tpl.php and added the following code:

<?php
echo 'test?';
exit;
?>

I'm using 'garland' as a theme and it's still showing garland's template.


texts: How to route dynamic routes to a single node while keeping the urls?

texts:
I have a node node/1 with the path alias /path. What I want is for /path/* to always behave like you went to /path, but not change the url. So going to /path/test?something=1 should behave identically to going to /path but the url will still be /path/test?something=1 in the user's browser.

Right now, I'm getting a redirect loop when I return the same url in the processOutbound method. If I just return $path in this method, the user gets redirected to /path?something=1.

My use case is a vue app that has it's own routing. But we need a node to allow the client to edit the content around the app.

Code below. Thanks!

<?php

namespace Drupal\gm_custom;

use Drupal\Core\PathProcessor\OutboundPathProcessorInterface;
use Drupal\Core\Render\BubbleableMetadata;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\PathProcessor\InboundPathProcessorInterface;

class PathSubscriber implements InboundPathProcessorInterface, OutboundPathProcessorInterface
{
    /**
     * Processes the inbound path.
     *
     * @param string $path
     *   The path to process, with a leading slash.
     * @param \Symfony\Component\HttpFoundation\Request $request
     *   The HttpRequest object representing the current request.
     *
     * @return string
     *   The processed path.
     */
    public function processInbound($path, Request $request)
    {
        if ($this->stringStartsWith('/plan/', strtolower($path))) {
            return '/node/1';
        }

        return $path;
    }

    public function processOutbound(
        $path,
        &$options = [],
        Request $request = null,
        BubbleableMetadata $bubbleable_metadata = null
    ) {
        $url = strtok($_SERVER[ "REQUEST_URI" ], '?');
        if ($this->stringStartsWith('/plan/', $_SERVER[ 'REQUEST_URI' ])) {
            return $url;
        }

        return $path;
    }

    protected function stringStartsWith($needle, $haystack)
    {
        return (substr($haystack, 0, strlen($needle)) === $needle);
    }
}

Edit
I've confirmed it's the redirect module is the issue. Simply installing it creates the above problem. Still looking for a solution.


texts: what are the consequences of altering the users schema?

texts: I was tasked with altering the signature/signature format and make the length larger than 255. Within the given time, I had to alter the table using hook_schema_alter, db_change_field and hook_update. While I am aware this is semi hacking, I want to know what if this could have a huge consequence on my website.


texts:
I'm really confused with how to theme menus in Drupal 7 and I've found the Menu block module which is supposed to makes things simpler. Turns out it's not that simple for me.

I've created a Menu block called "myfooter" and thanks to the Menu block documentation page I was able to determine that the mytheme_menu_link__menu_block__myfooter() function seems to be acting on the menu. Huzzah.

But I don't know how to use it at all. It's not as if there was a $variables inside and I could var_dump the var to try and understand what's in it.

Currently, I'm only doing the following to check that it's actually replacing my menu items by a simple print statement:

function mytheme_menu_link__menu_block__myfooter() {
  print 'test string';
}

Basically, my problem is that Drupal outputs the menu with an unordered list structure that I don't need.

Item1

Item2

How can I wipe it to simply print my items one after another, with a pipe sign or dash or whatever separator I wish? Is mytheme_menu_link__menu_block__myfooter() even sensible to achieve that?

I've found a bunch of Drupal menu functions in the API but they are all so confusing I feel like I should stick to what Menu block offers.


texts: How can I undo the changes made by setting a private file system path?

texts:
I was installing the demo module on D7. I wanted to create a snapshot to use the demo reset part of the module. It told me to set the private file system path. So I entered the directory where all my websites live. /var/www/vhosts/domainname.com/ . Inside that folder there is a folder by domain name for each domain in the subscription. Including the folder for the site where i changed the path.

Now all the websites that are contained on the subscription are broken. As you can imagine, I'm desperate to know how to undo whatever I did. I'm so confused as yto how it has effected the other websites. I thought it was just going to be used to store the snapshot.


texts: How to Link Title field to another field which links to an external site?

texts:
I have a collection of news stories whose default linkable values (titleField and fullStoryHereField) link to their specific nodes.
However if the user wants to link to an external site, the user can specify a link in the fullStoryHereField (in where the news story is entered) and now the fullStoryHereField link goes to the external site while the rest go to their specific nodes…Good

Now here is what I want my titleField to do once clicked, either go to: (a) their specific node if no external link is given or (b) the external link that was given.

How can I accomplish that?

I want to keep my fields displayed in a certain order too:

    Title
    Teaser
    Full Story Here

I’ve tried a whole array of things, including trying to add different fields and link them to fullStoryHereField and mark them as hidden, however, I cannot link the new field back to my titleField in the order I want things displayed.

I’m trying to avoid editing the php/tpl files as I want to accomplish this in the Drupal application


texts: Cache is not clearing, deleted template is still loading

texts:
I created a new node template named node--artist-page.tpl.php and it worked fine. but then, (i'm brand new at this) when saw i made some errors with it i tried deleting it but Drupal keeps loading it!

i can tell because i echoe'd out an alert saying the 'my new node tpl is running'

in addition to clearing the cache (5 or more times) I even put it in the trash but it still loads!, anyone have any experience like this? or know how to fix?

am really stuck right now.


texts: Programatically create nodes, taxonomies and relationships via exisiting database

texts:
I have a client that wants a Drupal port. They have a MySql DB with a small built by hand backend. The data structure is about standard in terms of a business organization.

People

Department
Specialty
Location
Etc

How can I create taxonomies as well as nodes from a MySql Script from the old database?


texts: Adding a base field definition in an update hook - it's not appearing

texts:
I want to add another base field to a Drupal entity. It used to be possible to just change the code for the entity definition and then update it via the Drupal console. But now it has to be done in an update hook.

I've added the following update hook, done drush updb and the process completes without errors. I then did drush cr to clear the cache, and then opened up the edit form for the entity in question and gave it a hard refresh. But the new field has not appeared. Any idea what I'm doing wrong? Thanks. The code is based on this: https://www.drupal.org/node/3034742, section named "Installing a new field storage definition".

function opencase_entities_update_8002() {
  $storage_definition =  \Drupal\Core\Field\BaseFieldDefinition::create('datetime')
      ->setLabel(t('Date and time'))
      ->setDescription(t('When the activity started.'))
      ->setRevisionable(TRUE)
      ->setSettings([
        'datetime_type' => 'date'
      ])
      ->setDefaultValue('2000-01-01')
      ->setDisplayOptions('view', [
        'label' => 'above',
        'weight' => -3,
      ])
      ->setDisplayOptions('form', [
        'weight' => -3,
      ]);

  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('activity_date_time', 'oc_activity', 'oc_activity', $storage_definition);
}


texts: What's the difference between "rebuild links" and what cron does in xmlsitemap?

texts:
Kind of a newbie question about the XML Sitemap module, I suppose...

I've got the module installed, and it's running, with the "XML sitemap node" module also installed and activated.  It's working, but I'm uncertain about how/when changes in node availability are reflected in the sitemap.  In my testing, I've changed a couple of nodes by modifying their node access records, making them inaccessible to the anonymous user (this is what the site will actually be doing).  If I refresh the sitemap.xml "file", the nodes still show up, even after running the sitemap's cron actions.  It's not until I run the "Rebuild links" action that the sitemap shows the proper thing.

I can see, and have hacked around with, a couple of places where this behavior might be controlled the "change frequency" dropdown in XML sitemap settings, or the frequency with which the cron job runs.  But the only thing that reliably changes the sitemap for me is "Rebuild links", and I understand that's not the right way to do it in a regular sense.  What is?  How/when will these changes get made in the site map, and where do I control it?


texts: Is there any way to get only the custom roles?

texts:
I would like a list of all custom roles.
Currently I am loading all of them using

$roles = $this->entityManager->getStorage('user_role')->loadMultiple();

but am wondering if there is any function that only brings the custom ones besides manually creating a static filter for the Anonymous, Authenticated and Administrator.


texts: Can't get generated content to push footer down

texts:
I have been hitting my CSS head against the wall for hours now.  I'm not sure what I am doing wrong but I sure would appreciate some insight.

I've got a view that is populated by a content type that has an image and text.  I've tried at least three sticky footer approaches and none worked.

We took bartik and modified the CSS as we've moved forward.  I don't know if there's some css remnant of bartik wreaking havoc or my own CSS ineptitude.  But we need to get it fixed and any help would be greatly appreciated.

Scott.


texts: How to display date picker and time picker in line?

texts:
When I set the time in "#date_format", a time picker is added below the date picker. How could I set it in the same row as the date picker?

Code:

$form['alert']['endDate'] = [
  '#default_value'       => !empty($endDate) ? Utils::formatDate($endDate) : date('Y-m-d', strtotime("+1 month", time())),
  '#date_format'         => 'd/m/Y H:i',
  '#date_label_position' => 'within',
  '#prefix'              => '
',
  '#suffix'              => '

',
  '#title'               => t('End Date'),
  '#type'                => 'date_popup',
];

Result:


texts: How to modify the layout or look-and-feel of a specific node?

texts:
How to modify the layout or look-and-feel of a specific node

Example path is example.com/node/230

Which file tpl file should I copy and rename to the id above?

I had done it before in Drupal 6, but when I try to do in Drupal 7 it failed.


texts:
Hi I am newbe in Drupal 8 and learning the new plugin system introduced in Drupal 8. I understood the concept of pluggin and also created few plugins like block and field fomatters. But I am not able to undestand the defination of pluging. Like it says

  "A plugin is a small piece of functionality that may be swapped in and
  out of your drupal site"

Can someone please explain (with example) the term swapped is used in context of Drupal 8.


texts: Search inside the view, if not found, how to set up no results behaviour?

texts: All view need a No results behaviour, this applies to Courses list(view), information list(view) and activities list(view);please tell to how to do this


texts:
I created a field field_quantity_description that contains HTML code. I can output the escaped content of this field:

{{ quantity.entity.field_quantity_description.value }}

I want to render HTML inside this field, so I usually use raw filter like this:

{{ quantity.entity.field_quantity_description.value|raw }}

But Drupal 9 tells me that raw is deprecated. But what do I have to use instead to render HTML inside the field?


texts: View with relationship - column displaying count of related nodes

texts:
I have a content type ("Interviewee") and a Media entity using the new media stuff in core (e.g. Remote Video) which have entity references back to the Interviewee entity.

I then have a view of the Interviewee content type, with a relationship to Media.

Rather than displaying multiple rows per person for each related media file, I'd just like display the total number of audio/video files linked to that content type in a column – including, this is important, a 0 for anyone who doesn't have media files - also ideally the column would be sortable.

Is this kind of basic counting of relationships possible in core / with a widely used module, without having to code a custom views field or a views sort plugin?

I've written similar plugins before, however I kind of assumed I could do it using aggregation - but I'm not getting anywhere.


texts: Have To Recreate Feature After Rollback - Features Module

texts:
I have strange issue. I have several node instances included part of the packaged feature XXX that service as test pages. These node instances have two fields - the default body and extra text field 'description'. When I install this feature for the first time on new Drupal site, everything works. If I roll back via Migrate_backup or physically dropping all tables, the second time installing the same feature all body fields is coming up empty and the extra field 'description' is not installed at all

There is no messages in the watchdog log. My current versions:

Feature 7.x-2.0
uuid_features 7.x-1.0-alpha3
fe_block 7.x-1.0-beta1
strongarm 7.x-2.0

I also tried this with newest dev versions of uuid_features, fe_block, strongarm, but the same issue

My solution is recreating feature with different name but its unnecessary extra work and time. Have you ever experienced this issue? How would you troubleshoot? Can i enable some kind debug mode for feature installation or any module for that matter? I may be just doing it wrong as this my first experience with Features module. Thank You